]> git.wh0rd.org - fontconfig.git/commitdiff
Fix string memory leak (Coverity defect #1823).
authorPatrick Lam <plam@MIT.EDU>
Mon, 10 Apr 2006 19:33:03 +0000 (19:33 +0000)
committerPatrick Lam <plam@MIT.EDU>
Mon, 10 Apr 2006 19:33:03 +0000 (19:33 +0000)
Fix memory leak with hash collision (Coverity defect #1824).
reviewed by: plam

ChangeLog
src/fccache.c
src/fccfg.c

index c1185f6d4bbe0e1b2f4c4bdab49adc171b239e12..b35be7adefa05dfd516359deccabaa356c7e5042 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
        
index 042439ee342cba14245e6bc87cb56a5826b75957..23c37f12ba8146f0475da1d7fc046ed5f41f93ff 100644 (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;
        }
index 7f8a8ff21c156a18e4cc32fa74dd7873c363a3c8..fc70fefd09af5fcefbd0e1408d61a0857e6df930 100644 (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;