Bug 13601

Summary: wrong logic? after malloc fails in fcxml.c
Product: fontconfig Reporter: Hongbo Zhao <hongbo.zhao>
Component: libraryAssignee: Keith Packard <keithp>
Status: RESOLVED FIXED QA Contact:
Severity: trivial    
Priority: low    
Version: 2.5   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 14062    

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.