Re: Patch: fix memory leak (spotted by Coverity)

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

 



Le lundi 10 avril 2006 à 11:46 -0400, Patrick Lam a écrit :
> Frederic Crozat wrote:
> > The following patch fixes memory and file descriptor leaks (Coverity
> > reports #777 and #1826) in error cases for FcDirScanConfig.
> > 
> > Please review this patch carefully, as I used goto for bail conditions
> > and tried to call free functions only one time in the FcDirScanConfig
> > code (to ease code review in the future).
> 
> I've committed the earlier patches, but not this one yet.

Great.

Here is another memleak fix for non-error case in FcGlobalCacheSave
(Coverity report #1825).

-- 
Frederic Crozat <fcrozat@xxxxxxxxxxxx>
Mandriva
Index: ChangeLog
===================================================================
RCS file: /cvs/fontconfig/fontconfig/ChangeLog,v
retrieving revision 1.109.2.186
diff -u -p -r1.109.2.186 ChangeLog
--- ChangeLog	10 Apr 2006 15:46:34 -0000	1.109.2.186
+++ ChangeLog	10 Apr 2006 16:04:08 -0000
@@ -1,4 +1,14 @@
 2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
+
+	* src/fccache.c: (FcGlobalCacheSave):
+	Don't leak header in non-error case (Coverity defect #1825).
+
+2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
 	reviewed by: plam
 
 	* src/fccache.c: (FcDirCacheWrite):
Index: src/fccache.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fccache.c,v
retrieving revision 1.23.4.81
diff -u -p -r1.23.4.81 fccache.c
--- src/fccache.c	10 Apr 2006 15:46:34 -0000	1.23.4.81
+++ src/fccache.c	10 Apr 2006 16:04:08 -0000
@@ -501,6 +501,8 @@ FcGlobalCacheSave (FcGlobalCache    *cac
     if (!FcCacheWriteString (fd, header))
 	goto bail4;
 
+    free (header);
+
     for (dir = cache->dirs; dir; dir = dir->next)
     {
 	int i;
_______________________________________________
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