Fix OOM failure case in FcPStackPush.

When allocation for the node attributes fail, clean up the node allocation
and report failure.
This commit is contained in:
Keith Packard 2007-12-23 14:06:41 -08:00
parent 0f7870887a
commit 0aa5fbaa0d
1 changed files with 5 additions and 0 deletions

View File

@ -968,7 +968,12 @@ FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
{
new->attr = FcConfigSaveAttr (attr);
if (!new->attr)
{
FcConfigMessage (parse, FcSevereError, "out of memory");
FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
free (new);
return FcFalse;
}
}
else
new->attr = 0;