Frederic Crozat wrote:
Coverity found two memory leaks in fccharset.c : FcCharSetPutLeaf (#1192 and #1193) in the "if (fcs->bank != FC_BANK_DYNAMIC)" TRUE branch : leaves and numbers. But after reading this part of the code, I'm not sure if it is doing anything at all : memory is allocated for leaves and numbers but those variables are not used at all after "if () {} else {}" stuff, so they are leaked and not used at all.. Could somebody with much more knowledge of this code check it ?
Oops! I meant to do this: Index: src/fccharset.c =================================================================== RCS file: /cvs/fontconfig/fontconfig/src/fccharset.c,v retrieving revision 1.25.4.13 diff -u -p -r1.25.4.13 fccharset.c --- src/fccharset.c 7 Apr 2006 17:27:39 -0000 1.25.4.13 +++ src/fccharset.c 11 Apr 2006 14:18:55 -0000 @@ -168,6 +168,7 @@ FcCharSetPutLeaf (FcCharSet *fcs, return FcFalse; if (fcs->bank != FC_BANK_DYNAMIC) { + /* convert to dynamic */ int i; leaves = malloc ((fcs->num + 1) * sizeof (FcCharLeaf *)); @@ -183,6 +184,10 @@ FcCharSetPutLeaf (FcCharSet *fcs, leaves[i] = FcCharSetGetLeaf(fcs, i); memcpy (numbers, FcCharSetGetNumbers(fcs), fcs->num * sizeof (FcChar16)); + + fcs->bank = FC_BANK_DYNAMIC; + fcs->u.dyn.leaves = leaves; + fcs->u.dyn.numbers = numbers; } else { I've committed all of your patches as well as this one. pat _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig