From 0aa5fbaa0df9d6c7bee8e0839dd443de9c48a402 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 23 Dec 2007 14:06:41 -0800 Subject: [PATCH] Fix OOM failure case in FcPStackPush. When allocation for the node attributes fail, clean up the node allocation and report failure. --- src/fcxml.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fcxml.c b/src/fcxml.c index cec9f6f..1910306 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -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;