Bug 13601 - wrong logic? after malloc fails in fcxml.c
Summary: wrong logic? after malloc fails in fcxml.c
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.5
Hardware: All All
: low trivial
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14062
  Show dependency treegraph
 
Reported: 2007-12-10 19:12 UTC by Hongbo Zhao
Modified: 2008-05-03 19:41 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Hongbo Zhao 2007-12-10 19:12:57 UTC
For version 2.5.0, on line 970 and 971 in source file fcxml.c, in subroutine FcPStackPush(),

Original lines:
        if (!new->attr)
            FcConfigMessage (parse, FcSevereError, "out of memory");

Should change to:
        if (!new->attr)
        {
            FcConfigMessage (parse, FcSevereError, "out of memory");
            return FcFalse;
        }
Comment 1 Keith Packard 2007-12-10 21:39:07 UTC
I think it should read:

        if (!new->attr)
        {
            FcConfigMessage (parse, FcSevereError, "out of memory");
            FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
            free (new);
            return FcFalse;
        }

so that it cleans up the other allocation.
Comment 2 Keith Packard 2008-05-03 19:41:03 UTC
Fixed some time ago. Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.