diff options
author | Patrick Lam <plam@MIT.EDU> | 2006-04-11 14:20:59 +0000 |
---|---|---|
committer | Patrick Lam <plam@MIT.EDU> | 2006-04-11 14:20:59 +0000 |
commit | 04f7d3e7fd5069965bc74e678fc51b0412d15aa9 (patch) | |
tree | 9e5c852042dc571817a7226f31e658cba2411d06 /src/fcpat.c | |
parent | af2ad236f037c7a53e73b9454f620de1a52f0422 (diff) |
Properly convert static charsets to dynamic charsets.
Fix memory leak in error case (Coverity defects #1820, #1821, #1822).
Fix memory leak (Coverity defect #1819).
prevent crash when invalid include line is parsed (Coverity defect #763).
Fix potential null pointer access (Coverity defect #1804).
Remove dead code (Coverity defect #1194).
Prevent potential null pointer access (Coverity defect #767), ensure error
value is read (Coverity defect #1195).
reviewed by: plam
Diffstat (limited to 'src/fcpat.c')
-rw-r--r-- | src/fcpat.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/fcpat.c b/src/fcpat.c index ba88ebf9..5865546c 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -399,7 +399,10 @@ FcValueListEntCreate (FcValueListPtr h) return 0; new = malloc (n * sizeof (FcValueList)); if (!new) + { + free (ea); return 0; + } memset(new, 0, n * sizeof (FcValueList)); FcMemAlloc (FC_MEM_VALLIST, size); e = &ea->ent; @@ -575,11 +578,14 @@ FcPatternBaseFreeze (FcPattern *b) ep = FcPatternCreate(); if (!ep) - return 0; + goto bail; ent->pattern = ep; epp = malloc(b->num * sizeof (FcPatternElt)); if (!epp) + { + FcPatternDestroy (ep); goto bail; + } ep->elts = FcPatternEltPtrCreateDynamic(epp); FcMemAlloc (FC_MEM_PATELT, sizeof (FcPatternElt)*(b->num)); @@ -650,7 +656,10 @@ FcPatternFreeze (FcPattern *p) e = malloc(b->num * sizeof (FcPatternElt)); if (!e) + { + FcPatternDestroy (b); return 0; + } b->elts = FcPatternEltPtrCreateDynamic(e); FcMemAlloc (FC_MEM_PATELT, sizeof (FcPatternElt)*(b->num)); |