[Impeller] Fix leak of rectangle packer in typographer tests (#51113)

diff --git a/impeller/typographer/rectangle_packer.cc b/impeller/typographer/rectangle_packer.cc
index b80faa7..bebecf6 100644
--- a/impeller/typographer/rectangle_packer.cc
+++ b/impeller/typographer/rectangle_packer.cc
@@ -166,8 +166,9 @@
   }
 }
 
-RectanglePacker* RectanglePacker::Factory(int width, int height) {
-  return new SkylineRectanglePacker(width, height);
+std::unique_ptr<RectanglePacker> RectanglePacker::Factory(int width,
+                                                          int height) {
+  return std::make_unique<SkylineRectanglePacker>(width, height);
 }
 
 }  // namespace impeller
diff --git a/impeller/typographer/rectangle_packer.h b/impeller/typographer/rectangle_packer.h
index 9213cae..48365a5 100644
--- a/impeller/typographer/rectangle_packer.h
+++ b/impeller/typographer/rectangle_packer.h
@@ -27,7 +27,7 @@
   //----------------------------------------------------------------------------
   /// @brief     Return an empty packer with area specified by width and height.
   ///
-  static RectanglePacker* Factory(int width, int height);
+  static std::unique_ptr<RectanglePacker> Factory(int width, int height);
 
   virtual ~RectanglePacker() {}