Bug 19207 - perf/cairo-perf-report.c:455: Memory leak: baseName
Summary: perf/cairo-perf-report.c:455: Memory leak: baseName
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:59 UTC by dvice_null
Modified: 2008-12-20 11:15 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description dvice_null 2008-12-20 10:59:17 UTC
This was found from the latest git version.

In file perf/cairo-perf-report.c:455: 
Variable baseName allocates memory with strdup but never releases it. Is the strdup() and the whole variable even necessary here?

    char *baseName;

    configuration = xmalloc (strlen (filename) * sizeof (char) + 1);
    strcpy (configuration, filename);
    baseName = strdup (basename (configuration));
    report->configuration = xmalloc (strlen (filename) * sizeof (char) + 1);
    strcpy(report->configuration, baseName);

This bug was found using cppcheck: http://cppcheck.wiki.sourceforge.net/
Comment 1 Chris Wilson 2008-12-20 11:15:58 UTC
Fixed in local tree.


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.