Patch reduces memory leaks detected by valgrind while debugging fbi

--- fontconfig-2.8.0/src/fcmatch.c      2009-11-16 22:46:18.000000000 +0000
+++ src/fontconfig-2.8.0/src/fcmatch.c  2012-01-15 18:03:11.000000000 +0000
@@ -552,6 +552,7 @@
     if (best)
        return FcFontRenderPrepare (config, p, best);
     else
+       FcPatternDestroy(best);
        return NULL;
 }
 
--- fontconfig-2.8.0/src/fcpat.c        2009-11-16 22:46:18.000000000 +0000
+++ src/fontconfig-2.8.0/src/fcpat.c    2012-01-15 20:27:07.000000000 +0000
@@ -361,6 +361,8 @@
                    e = malloc(s * sizeof (FcPatternElt));
                    if (e)
                        memcpy(e, e0, p->num * sizeof (FcPatternElt));
+                   else if (!e)
+                       return FcFalse;
                }
            }
            else
@@ -519,14 +521,15 @@
        new->next = e->values;
        e->values = new;
     }
-    
+
     return FcTrue;
 
 bail2:    
+    FcPatternDestroy(p);
     FcValueDestroy (value);
 bail1:
     FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
-    free (new);
+    FcValueListDestroy(new);
 bail0:
     return FcFalse;
 }





-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to