Fix leaks

This commit is contained in:
Akira TAGOH 2018-05-25 13:51:10 +09:00
parent f098adac54
commit 684c3ce685
1 changed files with 9 additions and 0 deletions

View File

@ -2777,6 +2777,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
{ {
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
} }
else
{
if (parse->scanOnly && vstack->u.string)
FcStrFree (vstack->u.string);
}
break; break;
case FcVStackPattern: case FcVStackPattern:
if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config, if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config,
@ -2786,7 +2791,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
} }
else else
{
if (parse->scanOnly && vstack->u.pattern)
FcPatternDestroy (vstack->u.pattern);
vstack->tag = FcVStackNone; vstack->tag = FcVStackNone;
}
break; break;
default: default:
FcConfigMessage (parse, FcSevereWarning, "bad font selector"); FcConfigMessage (parse, FcSevereWarning, "bad font selector");