parent
4b9f3c68fb
commit
3e47acd580
|
@ -971,7 +971,7 @@ void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpenin
|
||||||
const Library::AllocFunc* deallocFunc = mSettings->library.getDeallocFuncInfo(tokName);
|
const Library::AllocFunc* deallocFunc = mSettings->library.getDeallocFuncInfo(tokName);
|
||||||
VarInfo::AllocInfo dealloc(deallocFunc ? deallocFunc->groupId : 0, VarInfo::DEALLOC, tokName);
|
VarInfo::AllocInfo dealloc(deallocFunc ? deallocFunc->groupId : 0, VarInfo::DEALLOC, tokName);
|
||||||
if (const Library::AllocFunc* allocFunc = mSettings->library.getAllocFuncInfo(tokName)) {
|
if (const Library::AllocFunc* allocFunc = mSettings->library.getAllocFuncInfo(tokName)) {
|
||||||
if (allocFunc->arg == argNr) {
|
if (allocFunc->arg == argNr && !(arg->variable() && arg->variable()->isArgument() && arg->valueType() && arg->valueType()->pointer > 1)) {
|
||||||
leakIfAllocated(arg, varInfo);
|
leakIfAllocated(arg, varInfo);
|
||||||
VarInfo::AllocInfo& varAlloc = varInfo.alloctype[arg->varId()];
|
VarInfo::AllocInfo& varAlloc = varInfo.alloctype[arg->varId()];
|
||||||
varAlloc.type = allocFunc->groupId;
|
varAlloc.type = allocFunc->groupId;
|
||||||
|
|
|
@ -355,7 +355,6 @@ void memleak_asprintf(char **ptr, const char *fmt, const int arg)
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
if (-1 != asprintf(ptr,fmt,arg)) {}
|
if (-1 != asprintf(ptr,fmt,arg)) {}
|
||||||
// cppcheck-suppress memleak
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void memleak_asprintf2() { // #12186
|
void memleak_asprintf2() { // #12186
|
||||||
|
@ -372,6 +371,15 @@ void memleak_asprintf3() {
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void memleak_asprintf4(char** p) {
|
||||||
|
asprintf(p, "%s", "test");
|
||||||
|
}
|
||||||
|
|
||||||
|
void memleak_asprintf5(char* p) {
|
||||||
|
asprintf(&p, "%s", "test");
|
||||||
|
// cppcheck-suppress memleak
|
||||||
|
}
|
||||||
|
|
||||||
void memleak_xmalloc()
|
void memleak_xmalloc()
|
||||||
{
|
{
|
||||||
char *p = (char*)xmalloc(10);
|
char *p = (char*)xmalloc(10);
|
||||||
|
|
Loading…
Reference in New Issue