Re: Patch: add null pattern check (spotted by Coverity)

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

 



Yet another patch for Coverity defect :

this checks again null pattern (only in low memory case when malloc
returns NULL).

-- 
Frederic Crozat <fcrozat@xxxxxxxxxxxx>
Mandriva
Index: ChangeLog
===================================================================
RCS file: /cvs/fontconfig/fontconfig/ChangeLog,v
retrieving revision 1.109.2.185
diff -u -p -r1.109.2.185 ChangeLog
--- ChangeLog	7 Apr 2006 18:07:51 -0000	1.109.2.185
+++ ChangeLog	10 Apr 2006 12:31:59 -0000
@@ -1,3 +1,8 @@
+2006-04-10  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
+
+	* fc-match/fc-match.c: (main):
+	Check if pattern is not null before using it (Coverity defect #1883).
+
 2006-04-07  Dominic Lachowicz  <cinamod@xxxxxxxxxxx>
 	reviewed by: plam
 	* fc-cache/Makefile.am:
Index: fc-match/fc-match.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/fc-match/fc-match.c,v
retrieving revision 1.3.4.3
--- fc-match/fc-match.c	6 Apr 2006 04:33:11 -0000	1.3.4.3
+++ fc-match/fc-match.c	10 Apr 2006 12:31:59 -0000
@@ -134,6 +134,9 @@
     else
 	pat = FcPatternCreate ();
 
+    if (!pat)
+	return 1;
+
     FcConfigSubstitute (0, pat, FcMatchPattern);
     FcDefaultSubstitute (pat);
     
@@ -147,8 +150,8 @@
 	if (match)
 	    FcFontSetAdd (fs, match);
     }
-    if (pat)
-	FcPatternDestroy (pat);
+
+    FcPatternDestroy (pat);
 
     if (fs)
     {
_______________________________________________
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