shithub: freetype+ttf2subf

Download patch

ref: b10e45a7fb34f78f79ffb17c9db282e8ce7a4918
parent: 7d48cb06b4c1dbb30d62193c34aee6659851d110
author: Werner Lemberg <[email protected]>
date: Thu Jun 8 03:32:56 EDT 2006

* src/bdf/bdflib.c (bdf_load_font): Fix memory leaks in case of
errors.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-08  Werner Lemberg  <[email protected]>
+
+	* src/bdf/bdflib.c (bdf_load_font): Fix memory leaks in case of
+	errors.
+
 2006-06-07  David Turner  <[email protected]>
 
 	* src/type1/t1afm.c (KERN_INDEX): Make it more robust.
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -2224,7 +2224,7 @@
     error = _bdf_readstream( stream, _bdf_parse_start,
                              (void *)p, &lineno );
     if ( error )
-      goto Exit;
+      goto Fail;
 
     if ( p->font != 0 )
     {
@@ -2316,7 +2316,7 @@
         if ( FT_RENEW_ARRAY( p->font->comments,
                              p->font->comments_len,
                              p->font->comments_len + 1 ) )
-          goto Exit;
+          goto Fail;
 
         p->font->comments[p->font->comments_len] = 0;
       }
@@ -2337,6 +2337,15 @@
     }
 
     return error;
+
+  Fail:
+    bdf_free_font( p->font );
+
+    memory = extmemory;
+
+    FT_FREE( p->font );
+
+    goto Exit;
   }