Bug 10201 - buildroot-2017.08-rc1/toolchain/toolchain-wrapper.c:192]: (error) Memory leak:
Summary: buildroot-2017.08-rc1/toolchain/toolchain-wrapper.c:192]: (error) Memory leak:
Status: RESOLVED WONTFIX
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-09 20:18 UTC by David Binderman
Modified: 2017-08-11 14:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2017-08-09 20:18:41 UTC
Source code is

        basename = progpath;
        absbasedir = malloc(PATH_MAX + 1);
        ret = readlink("/proc/self/exe", absbasedir, PATH_MAX);
        if (ret < 0) {
            perror(__FILE__ ": readlink");
            return 2;
        }

Probably not worth much, but a call to free would shut up
the static analyser.
Comment 1 Arnout Vandecappelle 2017-08-11 14:15:45 UTC
Your static analyser is weird, because there are a few other things which aren't freed either: relbasedir, absbasedir in different code paths.

However, we do this by choice. Freeing things before exiting is useless, since the OS will implicitly free everything when the program exits. That's why e.g. valgrind doesn't report these as real memory leaks (because they are still reachable).

So no, this is not a memory leak.

For consistency, the free(args) at the end should be removed, but that's a different issue.