[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] potential of memory leaking in kern
From: |
Masatake YAMATO |
Subject: |
[Devel] potential of memory leaking in kern |
Date: |
Wed, 12 Nov 2003 21:08:37 +0900 (JST) |
Hi,
In tt_face_load_kern, the results of FT_NEW_ARRAY and FT_FRAME_ENTER
are checkd in single if-condition. If FT_NEW_ARRAY is successful but
FT_FRAME_ENTER is failed, the buffer allocated by FT_NEW_ARRAY will
be never freed.
Masatake YAMATO
2003-11-12 Masatake YAMATO <address@hidden>
* src/sfnt/ttload.c (tt_face_load_kern):
Before jumping to Exit, free face->kern_pairs if
FT_FRAME_ENTER is failed.
Index: src/sfnt/ttload.c
===================================================================
RCS file: /cvsroot/freetype2/src/sfnt/ttload.c,v
retrieving revision 1.102
diff -u -r1.102 ttload.c
--- ttload.c 2003/06/30 13:08:58 1.102
+++ ttload.c 2003/11/12 12:04:43
@@ -1674,9 +1674,13 @@
FT_FRAME_EXIT();
/* allocate array of kerning pairs */
- if ( FT_NEW_ARRAY( face->kern_pairs, num_pairs ) ||
- FT_FRAME_ENTER( 6L * num_pairs ) )
- goto Exit;
+ if ( FT_NEW_ARRAY( face->kern_pairs, num_pairs ) )
+ goto Exit;
+ if ( FT_FRAME_ENTER( 6L * num_pairs ) )
+ {
+ FT_FREE( face->kern_pairs );
+ goto Exit;
+ }
pair = face->kern_pairs;
limit = pair + num_pairs;
- [Devel] potential of memory leaking in kern,
Masatake YAMATO <=