Bug 19207

Summary: perf/cairo-perf-report.c:455: Memory leak: baseName
Product: cairo Reporter: dvice_null
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.9.1   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

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.