Bug 19206 - perf/cairo-perf-graph-files.c:322: Mismatching allocation and deallocation: id
Summary: perf/cairo-perf-graph-files.c:322: Mismatching allocation and deallocation: id
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.9.1
Hardware: All All
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-20 10:51 UTC by dvice_null
Modified: 2008-12-20 11:16 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description dvice_null 2008-12-20 10:51:19 UTC
I found this from latest git version.

In file perf/cairo-perf-graph-files.c:322: 
Variable id is allocated with:
char *id = g_malloc (len + 1);

And later released:
free (id);

"It's important to match g_malloc() with g_free(), plain malloc() with free(), and (if you're using C++) new with delete and new[] with delete[]. Otherwise bad things can happen, since these allocators may use different memory pools (and new/delete call constructors and destructors)."
http://library.gnome.org/devel/glib/stable/glib-Memory-Allocation.html

ps. The version drop down list does not have "git" or similar option for bugs found from the very latest source files. 

This bug was found using cppcheck: http://cppcheck.wiki.sourceforge.net/
Comment 1 Chris Wilson 2008-12-20 11:16:22 UTC
Fixed locally, will push in next batch.


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.