]> git.wh0rd.org - fontconfig.git/commitdiff
Fix OOM failure case in FcPStackPush.
authorKeith Packard <keithp@keithp.com>
Sun, 23 Dec 2007 22:06:41 +0000 (14:06 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 23 Dec 2007 22:06:41 +0000 (14:06 -0800)
When allocation for the node attributes fail, clean up the node allocation
and report failure.

src/fcxml.c

index cec9f6f11439c086c32c6cd92e0a0af043af35cf..19103062e45a3522f3f81f198653e3ba018eb7b6 100644 (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;