Fix string memory leak (Coverity defect #1823).

Fix memory leak with hash collision (Coverity defect #1824).
reviewed by: plam
This commit is contained in:
Patrick Lam 2006-04-10 19:33:03 +00:00
parent c814c301ee
commit 3ea92166a0
3 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2006-04-10 Frederic Crozat <fcrozat@mandriva.com>
reviewed by: plam
* src/fccfg.c: (FcConfigEvaluate):
Fix string memory leak (Coverity defect #1823).
* src/fccache.c: (FcDirCacheUnlink):
Fix memory leak with hash collision (Coverity defect #1824).
2006-04-10 Frederic Crozat <fcrozat@mandriva.com>
reviewed by: plam

View File

@ -854,6 +854,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
fd = open(cache_hashed, O_RDONLY | O_BINARY);
if (fd == -1)
{
FcStrFree ((FcChar8 *)cache_hashed);
FcStrFree ((FcChar8 *)cache_file);
return FcTrue;
}

View File

@ -893,6 +893,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcValue v, vl, vr;
FcResult r;
FcMatrix *m;
FcChar8 *str;
switch (e->op) {
case FcOpInteger:
@ -1023,7 +1024,9 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
switch (e->op) {
case FcOpPlus:
v.type = FcTypeString;
v.u.s = FcStrStaticName (FcStrPlus (vl.u.s, vr.u.s));
str = FcStrPlus (vl.u.s, vr.u.s);
v.u.s = FcStrStaticName (str);
FcStrFree (str);
if (!v.u.s)
v.type = FcTypeVoid;