Fix memory leak

This commit is contained in:
Akira TAGOH 2018-07-19 04:29:01 +00:00
parent 433718fb77
commit 37c9c16dad
1 changed files with 3 additions and 1 deletions

View File

@ -2190,6 +2190,7 @@ FcParseCacheDir (FcConfigParse *parse)
if (!data) if (!data)
{ {
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
data = prefix;
goto bail; goto bail;
} }
if (prefix) if (prefix)
@ -2201,7 +2202,7 @@ FcParseCacheDir (FcConfigParse *parse)
if (!p) if (!p)
{ {
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
data = prefix; FcStrFree (prefix);
goto bail; goto bail;
} }
prefix = p; prefix = p;
@ -2233,6 +2234,7 @@ FcParseCacheDir (FcConfigParse *parse)
else if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0) else if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0)
{ {
int rc; int rc;
FcStrFree (data); FcStrFree (data);
data = malloc (1000); data = malloc (1000);
if (!data) if (!data)