Be skeptical of bare |new|s.

In particular, prefer an explicit .release() call when handing
ownership of an object to a caller across a C-API.

Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1
Reviewed-on: https://pdfium-review.googlesource.com/5470
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp
index 54388ef..c2f2df9 100644
--- a/fpdfsdk/fpdfedittext.cpp
+++ b/fpdfsdk/fpdfedittext.cpp
@@ -388,11 +388,11 @@
   if (!pFont)
     return nullptr;
 
-  CPDF_TextObject* pTextObj = new CPDF_TextObject;
+  auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>();
   pTextObj->m_TextState.SetFont(pFont);
   pTextObj->m_TextState.SetFontSize(font_size);
   pTextObj->DefaultStates();
-  return pTextObj;
+  return pTextObj.release();  // Caller takes ownership.
 }
 
 DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object,