If a pointer is declared in one file(say A.h) and memory is allocated to it(be it "new" or "malloc") in another file(say A.cpp, that includes A.h) but not deallocated(be it "delete" or "free"), then cppcheck is not able to detect the memory leak.
Whereas if the pointer is declared and alocated memory to in the same file, then the memory leak is detected by cppcheck.
Do I need to configure cppcheck somehow to resolve this issue?
I am using cppcheck 1.67 integrated with Code::Blocks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, I would recommend to use stand-alone cppcheck and a recent version (1.74). If cppcheck can find the include file there is a chance that the issue is detected; however, there are limitations to analysis of global variables.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If a pointer is declared in one file(say A.h) and memory is allocated to it(be it "new" or "malloc") in another file(say A.cpp, that includes A.h) but not deallocated(be it "delete" or "free"), then cppcheck is not able to detect the memory leak.
Whereas if the pointer is declared and alocated memory to in the same file, then the memory leak is detected by cppcheck.
Do I need to configure cppcheck somehow to resolve this issue?
I am using cppcheck 1.67 integrated with Code::Blocks.
First of all, I would recommend to use stand-alone cppcheck and a recent version (1.74). If cppcheck can find the include file there is a chance that the issue is detected; however, there are limitations to analysis of global variables.