Bug 91381 - bad free in tests/pdf-mime-data.c
Summary: bad free in tests/pdf-mime-data.c
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-18 02:37 UTC by Matthias Clasen
Modified: 2015-07-30 23:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.