Re: Patch: fix memleak (spotted by Coverity)

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

 



Le lundi 10 avril 2006 à 12:07 -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 a modified version of this patch.  I think it's correct.

It looks ok to me.

To celebrate, here is another memleak fix (Coverity report #1824) for
FcDirCacheUnlink ;)

Don't worry, there are only 28 defects left to check, I'll probably
continue tomorrow...

-- 
Frederic Crozat <fcrozat@xxxxxxxxxxxx>
Mandriva
Index: ChangeLog
===================================================================
RCS file: /cvs/fontconfig/fontconfig/ChangeLog,v
retrieving revision 1.109.2.188
diff -u -p -r1.109.2.188 ChangeLog
--- ChangeLog	10 Apr 2006 16:12:55 -0000	1.109.2.188
+++ ChangeLog	10 Apr 2006 16:25:35 -0000
@@ -1,4 +1,9 @@
 2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
+
+	* src/fccache.c: (FcDirCacheUnlink):
+	Fix memory leak with hash collision (Coverity defect #1824).
+
+2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
 	reviewed by: plam
 	
 	* src/fccache.c: (FcGlobalCacheSave):
Index: src/fccache.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fccache.c,v
retrieving revision 1.23.4.82
diff -u -p -r1.23.4.82 fccache.c
--- src/fccache.c	10 Apr 2006 16:12:55 -0000	1.23.4.82
+++ src/fccache.c	10 Apr 2006 16:25:35 -0000
@@ -854,6 +854,7 @@ FcDirCacheUnlink (const FcChar8 *dir, Fc
 	fd = open(cache_hashed, O_RDONLY | O_BINARY);
 	if (fd == -1)
 	{
+	    FcStrFree ((FcChar8 *)cache_hashed);
 	    FcStrFree ((FcChar8 *)cache_file);
 	    return FcTrue;
 	}
_______________________________________________
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