Opened 10 days ago
#15137 new enhancement
CheckLeakAutoVar: --check-library accepts <use> functions
| Reported by: | Daniel Marjamäki | Owned by: | noone |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Other | Version: | |
| Keywords: | Cc: |
Description
Passing an allocated pointer to a function configured as <use> still gives a --check-library message:
use.cfg:
<memory>
<alloc>myalloc</alloc>
<use>set_data</use>
<dealloc>myfree</dealloc>
</memory>
<function name="myalloc"><noreturn>false</noreturn><arg nr="1"/></function>
<function name="set_data"><noreturn>false</noreturn><arg nr="1"/></function>
use.c:
void f(void)
{
char *p = myalloc(10);
set_data(p);
}
$ cppcheck --check-library --library=use.cfg use.c
use.c:5:1: warning: --check-library: Function set_data() should have <use>/<leak-ignore> configuration [checkLibraryUseIgnore]
The cfg reference says <use> exists to silence exactly this message, but CheckLeakAutoVarImpl::configurationInfo() only took <leak-ignore/> into account. It now skips functions that have <use> as well. The leak analysis itself is unchanged.
Test: TestLeakAutoVar::configurationUse; it fails without the change.
Note:
See TracTickets
for help on using tickets.