leaks in clang (many!)

Hello!

It is great that these leaks have been discovered!

As far as I see no tickets has been created in bugzilla that says that the static analyser should detect any of these.

Has anybody reviewed the leaks to see if any of them could be detected by static analysis?

Best regards,
Daniel Marjamäki

..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB Warfvinges väg 34 SE-112 51 Stockholm Sweden

Mobile: +46 (0)709 12 42 62
E-mail: Daniel.Marjamaki@evidente.se

www.evidente.se

A lot of them are cases where a function returns a Foo*, but the fact that it’s an owned Foo* is only in the documentation (or not written anywhere outside the .cpp file!). A few more have been cases where containers of Foo* get erased instead of deleted.

A “migration” warning/checker could complain about returning an owned pointer as a bare Foo* instead of as a std::unique_ptr (or llvm::IntrusiveRefCntPtr or similar).

The other problem is that the NewDeleteLeaks checker is currently still marked alpha, because we have a number of patterns that make it difficult to use (mainly constructors that escape ‘this’). We could add a new annotation to signal this case, but I’ve kind of been leery of more annotations until the analyzer_annotate attribute gets implemented (see http://clang-analyzer.llvm.org/open_projects.html).

Jordan

Slightly off-topic...