Re: Patch: fix memleak (spotted by Coverity)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I swear, this is the last fix for today ;)

This patch fixes a memleak in FcConfigEvaluate with strings (Coverity
defect #1823).

-- 
Frederic Crozat <fcrozat@xxxxxxxxxxxx>
Mandriva
Index: src/fccfg.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fccfg.c,v
retrieving revision 1.49.2.25
diff -u -p -r1.49.2.25 fccfg.c
--- src/fccfg.c	10 Apr 2006 15:46:34 -0000	1.49.2.25
+++ src/fccfg.c	10 Apr 2006 16:45:56 -0000
@@ -893,6 +893,7 @@
     FcValue	v, vl, vr;
     FcResult	r;
     FcMatrix	*m;
+    FcChar8     *str;
     
     switch (e->op) {
     case FcOpInteger:
@@ -1023,7 +1024,9 @@
 		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;
Index: ChangeLog
===================================================================
RCS file: /cvs/fontconfig/fontconfig/ChangeLog,v
--- ChangeLog	10 Apr 2006 16:12:55 -0000	1.109.2.188
+++ ChangeLog	10 Apr 2006 16:45:57 -0000
@@ -1,4 +1,9 @@
 2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
+
+	* src/fccfg.c: (FcConfigEvaluate):
+	Fix string memory leak (Coverity defect #1823).
+
+2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
 	reviewed by: plam
 	
 	* src/fccache.c: (FcGlobalCacheSave):
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux