Return unique_ptr<> from CFX_Font::LoadGlyphPathImpl()

Rather than releasing it and then having its caller re-wrap it in
an unique_ptr<>.

Change-Id: Ic76dae523ea6334585890c4d7f0bd97026193a48
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78731
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index d3d27f0..d077533 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -634,8 +634,9 @@
   FT_Set_MM_Design_Coordinates(m_Face->GetRec(), 2, coords);
 }
 
-CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
-                                          int dest_width) const {
+std::unique_ptr<CFX_PathData> CFX_Font::LoadGlyphPathImpl(
+    uint32_t glyph_index,
+    int dest_width) const {
   if (!m_Face)
     return nullptr;
 
@@ -692,8 +693,7 @@
 
   Outline_CheckEmptyContour(&params);
   pPath->ClosePath();
-
-  return pPath.release();
+  return pPath;
 }
 
 const CFX_GlyphBitmap* CFX_Font::LoadGlyphBitmap(
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 31e5c7e..00dcec7 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -104,7 +104,8 @@
   void SetSubData(uint8_t* data) { m_pGsubData.reset(data); }
   pdfium::span<uint8_t> GetFontSpan() const { return m_FontData; }
   void AdjustMMParams(int glyph_index, int dest_width, int weight) const;
-  CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, int dest_width) const;
+  std::unique_ptr<CFX_PathData> LoadGlyphPathImpl(uint32_t glyph_index,
+                                                  int dest_width) const;
 #if defined(OS_APPLE)
   void* GetPlatformFont() const { return m_pPlatformFont; }
   void SetPlatformFont(void* font) { m_pPlatformFont = font; }
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index 4c20bf3..05107e5 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -235,9 +235,8 @@
   if (it != m_PathMap.end())
     return it->second.get();
 
-  CFX_PathData* pGlyphPath = pFont->LoadGlyphPathImpl(glyph_index, dest_width);
-  m_PathMap[key] = std::unique_ptr<CFX_PathData>(pGlyphPath);
-  return pGlyphPath;
+  m_PathMap[key] = pFont->LoadGlyphPathImpl(glyph_index, dest_width);
+  return m_PathMap[key].get();
 }
 
 const CFX_GlyphBitmap* CFX_GlyphCache::LoadGlyphBitmap(