shithub: freetype+ttf2subf

Download patch

ref: 2e2f3cb5baf1aed20c4eda08e043a2cf2515f275
parent: 09b98060d3e0edfe78ea88ca8b851751a924ecac
author: Sebastian Rasmussen <[email protected]>
date: Fri Jun 19 12:29:07 EDT 2020

[psaux] Fix memory leak (#58626).

* src/psaux/psstack.c (cf2_stack_init): If `cf2_stack_init' fails to
allocate the stack, return error early.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2020-06-19  Sebastian Rasmussen  <[email protected]>
 
+	[psaux] Fix memory leak (#58626).
+
+	* src/psaux/psstack.c (cf2_stack_init): If `cf2_stack_init' fails to
+	allocate the stack, return error early.
+
+2020-06-19  Sebastian Rasmussen  <[email protected]>
+
 	[base] Fix memory leak (#58624).
 
 	* src/base/ftobjs.c (FT_New_Size): Avoid trying to free
--- a/src/psaux/psstack.c
+++ b/src/psaux/psstack.c
@@ -59,12 +59,12 @@
     CF2_Stack  stack = NULL;
 
 
-    if ( !FT_NEW( stack ) )
-    {
-      /* initialize the structure; FT_NEW zeroes it */
-      stack->memory = memory;
-      stack->error  = e;
-    }
+    if ( FT_NEW( stack ) )
+      return NULL;
+
+    /* initialize the structure; FT_NEW zeroes it */
+    stack->memory = memory;
+    stack->error  = e;
 
     /* allocate the stack buffer */
     if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )