Commit 09b98060d3e0edfe78ea88ca8b851751a924ecac

Sebastian Rasmussen 2020-06-19T16:21:08

Fix memory leak (#58624). * src/base/ftobjs.c (FT_New_Size): Avoid trying to free `size->internal`, unless `size' has been allocated. This mistake appeared in the fix for 58611.

diff --git a/ChangeLog b/ChangeLog
index 87bb491..b380a72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[base] Fix memory leak (#58624).
+
+	* src/base/ftobjs.c (FT_New_Size): Avoid trying to free
+	`size->internal' unless `size' has been allocated.  This mistake
+	appeared in the fix for issue #58611.
+
 2020-06-19  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[base] Rework d1180b5f9598 until further notice.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 2b4e6bb..78164c8 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2857,7 +2857,8 @@
     if ( error )
     {
       FT_FREE( node );
-      FT_FREE( size->internal );
+      if ( size )
+        FT_FREE( size->internal );
       FT_FREE( size );
     }