[cfe-dev] Static analyzer: possible memory leak false positive?

Eitan Adler lists at eitanadler.com
Fri Sep 28 10:32:37 PDT 2012


On 28 September 2012 07:37, Tijl Coosemans <tijl at coosemans.org> wrote:
> - Have the analyzer treat return from main like it treats a call to exit(),
>   at least by default (technically main could be called from another
>   function).

This is my preference. Having a default on tunable that treaks main()
like exit().

> - Have an analyzer_free() function which acts like free to the analyzer
>   but is a no-op to the compiler. The experimental malloc checker supports
>   this:

I would very much prefer not this option. It requires special annotation for the
analyzer to work correctly. csa has been very good about avoiding this
until now.

> - Declare mntbuf static which tells the analyzer the memory is allowed to
>   persist for the lifetime of the process.

This seems more of a workaround for an analyzer bug than a solution in
the general case.



-- 
Eitan Adler



More information about the cfe-dev mailing list