Bug 91381

Summary: bad free in tests/pdf-mime-data.c
Product: cairo Reporter: Matthias Clasen <mclasen>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Matthias Clasen 2015-07-18 02:37:50 UTC
In read_file(), we see:

    *data = malloc (*len);

    ...

    if (fread(*data, *len, 1, fp) != 1) {
      free(data);
      ...

The free call needs to be free(*data), to match the malloc call.

This was pointed out by coverity.
Comment 1 Bryce Harrington 2015-07-30 23:57:47 UTC
Thanks for the report.  Fix pushed to trunk.

To ssh://git.cairographics.org/git/cairo
   0dd5d84..c04bd43  master -> master


commit c04bd4308382db00347016e666f38fcfe8ee1f08
Author:     Bryce Harrington <bryce@osg.samsung.com>
AuthorDate: Thu Jul 30 16:45:15 2015 -0700
Commit:     Bryce Harrington <bryce@osg.samsung.com>
CommitDate: Thu Jul 30 16:45:15 2015 -0700

    test: Free the memory, not the pointer to the memory

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.