summaryrefslogtreecommitdiff
path: root/fc-match
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2006-04-10 15:46:34 +0000
committerPatrick Lam <plam@MIT.EDU>2006-04-10 15:46:34 +0000
commitae2aafe6028be658bd1de0fe2dd309799bf575f7 (patch)
tree20c7282b163e6986a107467077ece4f48b41eef5 /fc-match
parent86abd75965f598dba79a3df68e7bc4c5082a5764 (diff)
downloadfontconfig-ae2aafe6028be658bd1de0fe2dd309799bf575f7.tar.gz
Fix double free (spotted by Coverity, CID #1965).
Check if pattern is not null before using it (Coverity defect #1883). Fix memory leak with hash collision (Coverity defect #1829). Fix memory leak when bail cases (Coverity defect #1828). Don't leak directory name (Coverity defect #1827). reviewed by: plam
Diffstat (limited to 'fc-match')
-rw-r--r--fc-match/fc-match.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index 2666620..fa45018 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -134,6 +134,9 @@ main (int argc, char **argv)
else
pat = FcPatternCreate ();
+ if (!pat)
+ return 1;
+
FcConfigSubstitute (0, pat, FcMatchPattern);
FcDefaultSubstitute (pat);
@@ -147,8 +150,7 @@ main (int argc, char **argv)
if (match)
FcFontSetAdd (fs, match);
}
- if (pat)
- FcPatternDestroy (pat);
+ FcPatternDestroy (pat);
if (fs)
{