* Fix#11019 FN memleak with redundant pointer op
* Style
* Fix#7705 FN: Memory leak not detected on struct member
* Fix FP memleak with function call, fix cppcheckError
* Fix FP memleak with array
* Fix FPs memleak with array and ptr to ptr
* Fix FP memleak with unknown ptr typedef
* Format
* Fix#11019 FN memleak with redundant pointer op
* Style
* Fix#7705 FN: Memory leak not detected on struct member
* Fix FP memleak with function call, fix cppcheckError
* Fix FP memleak with array
* Fix FPs memleak with array and ptr to ptr
* Fix#11019 FN memleak with redundant pointer op
* Style
* Fix#7705 FN: Memory leak not detected on struct member
* Fix FP memleak with function call, fix cppcheckError
* Fix FP memleak with array
* Fix#11019 FN memleak with redundant pointer op
* Style
* Fix#7705 FN: Memory leak not detected on struct member
* Fix FP memleak with function call, fix cppcheckError
Skip scopes with lambdas (similar to how checkleakautovar does). In
order to fix this when the lambda is inside a for loop, make
hasInlineOrLambdaFunction() recursive. This should be what all existing
users want.
* Avoid some additional memleakOnRealloc false positives
checkReallocUsage() already contains code to suppress the
`p = realloc(p, size)` error message when the pointer has been
previously copied from another variable (hence there is an additional
copy of the original pointer value) within the same function, as in
the added realloc21() test case.
Extend this so that `p = *pp` and `p = ptr->foo` are also recognized
as copies from another variable with the same original pointer value,
as in the added realloc22() and realloc23() test cases.
* Rewrite as a single findmatch() expression
* cppcheck.cpp: Check for JSON error when parsing addon .json files
This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().
* naming.json: Fix missing comma
* CLI: Fix naming violations detected by addon naming.py via naming.json
* Addon naming: Add argument for validating names of constants
* LIB: Rename functions/variables so they are valid, loosen naming rules
* GUI: Fix naming violations
There seems to be no reason for stopping checking the scope if a call to
free() is seen (or fclose() or realloc()), so just continue checking.
Also, if there are multiple arguments, check all, perhaps there are more
memory leaks to warn about.
Use the AST a little bit more to improve the check. In order to do so,
rewrite the check to work from the outer function first and then check
the arguments, instead of the other way around.
It also fixes Trac ticket #9252, no warning is now given for
void* malloc1() {
return(malloc1(1));
}
This FP seems to be common in daca results.
It also makes it possible to improve handling of casts, for example
cppcheck now warns about
void f() {
strcpy(a, (void*) strdup(p));
}
But not for
char* f() {
char* ret = (char*)strcpy(malloc(10), "abc");
return ret;
}
These FP/FN were introduced when the check was switched to use the
simplified token list.