Fix a couple of minor memory leaks

These fixes are needed for the test suite to pass when compiled
with Address Sanitizer.
This commit is contained in:
Erik de Castro Lopo 2016-05-28 17:44:10 +11:00 committed by Akira TAGOH
parent 7441dbec03
commit ea26c5e9f8
2 changed files with 4 additions and 0 deletions

View File

@ -1173,6 +1173,7 @@ FcDirCacheLock (const FcChar8 *dir,
if (!cache_hashed)
break;
fd = FcOpen ((const char *)cache_hashed, O_RDWR);
FcStrFree (cache_hashed);
/* No caches in that directory. simply retry with another one */
if (fd != -1)
{
@ -1196,6 +1197,7 @@ FcDirCacheLock (const FcChar8 *dir,
FcStrListDone (list);
return fd;
bail:
FcStrListDone (list);
if (fd != -1)
close (fd);
return -1;

View File

@ -34,5 +34,7 @@ main (void)
FcConfigAppFontAddFile (config, (const FcChar8 *)"/dev/null"))
return 1;
FcConfigDestroy (config);
return 0;
}