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>
This commit is contained in:
parent
cb72901d0b
commit
5b8380d52e
|
@ -924,12 +924,16 @@ FcStrBuildFilename (const FcChar8 *path,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
FcStrSet *sset = FcStrSetCreate ();
|
FcStrSet *sset;
|
||||||
FcStrList *list;
|
FcStrList *list;
|
||||||
FcChar8 *s, *ret = NULL, *p;
|
FcChar8 *s, *ret = NULL, *p;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
if (!sset || !path)
|
if (!path)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
sset = FcStrSetCreate ();
|
||||||
|
if (!sset)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!FcStrSetAdd (sset, path))
|
if (!FcStrSetAdd (sset, path))
|
||||||
|
|
Loading…
Reference in New Issue