summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-02 10:23:56 -0700
committerAkira TAGOH <akira@tagoh.org>2013-11-05 11:43:41 +0900
commit5b8380d52eae55cba0adcc47d78a53c320d294ec (patch)
tree8095c57d0acbcf87f411beb379fa4b689b9fb99f
parentcb72901d0b7dff73ea2596491c5db602e4750853 (diff)
Avoid memory leak when NULL path passed to FcStrBuildFilename
Reported by parfait 1.3: Memory leak of pointer sset allocated with FcStrSetCreate() at line 933 of src/fcstr.c in function 'FcStrBuildFilename'. sset allocated at line 927 with FcStrSetCreate(). sset leaks when sset != NULL at line 932. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/fcstr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fcstr.c b/src/fcstr.c
index 57071724..024dae32 100644
--- a/src/fcstr.c
+++ b/src/fcstr.c
@@ -924,12 +924,16 @@ FcStrBuildFilename (const FcChar8 *path,
...)
{
va_list ap;
- FcStrSet *sset = FcStrSetCreate ();
+ FcStrSet *sset;
FcStrList *list;
FcChar8 *s, *ret = NULL, *p;
size_t len = 0;
- if (!sset || !path)
+ if (!path)
+ return NULL;
+
+ sset = FcStrSetCreate ();
+ if (!sset)
return NULL;
if (!FcStrSetAdd (sset, path))