summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-05 20:47:09 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-05 20:47:09 -0800
commit75de0f3d8b7bd9541a8a9528ab63e51fa9c57b17 (patch)
treea9fe08349ebe16f2be0e2ff75d0cb956a4c888ce
parent525785fd7beca872ebeeb8bb6c22d82459128788 (diff)
Fix memory leak on failure in getFontencCharset
Error: Memory leak (CWE 401) Memory leak of pointer 'c' allocated with malloc(80) at line 297 of app/luit/charset.c in function 'getFontencCharset'. 'c' allocated at line 290 with malloc(80). at line 303 of app/luit/charset.c in function 'getFontencCharset'. 'c' allocated at line 290 with malloc(80). [ This bug was found by the Parfait 0.4.2 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--charset.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/charset.c b/charset.c
index c74f262..8b72225 100644
--- a/charset.c
+++ b/charset.c
@@ -293,12 +293,14 @@ getFontencCharset(unsigned final, int type, const char *name)
mapping = FontEncMapFind(fc->xlfd, FONT_ENCODING_UNICODE, -1, -1, NULL);
if (!mapping) {
+ free(c);
fc->type = T_FAILED;
return NULL;
}
reverse = FontMapReverse(mapping);
if (!reverse) {
+ free(c);
fc->type = T_FAILED;
return NULL;
}