diff --git a/man/manual.docbook b/man/manual.docbook index f80b3c226..2db19c4ed 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -549,8 +549,9 @@ Checking test.c...
User-defined allocation/deallocation functions - Cppcheck understands many common allocation and - deallocation functions. But not all. + Cppcheck understands standard allocation and + deallocation functions. But it doesn't know what library functions + do. Here is example code that might leak memory or resources: @@ -564,11 +565,11 @@ Checking test.c... If you analyse that with Cppcheck it won't find any leaks: - cppcheck --enable=possibleError fred1.cpp + cppcheck fred1.c You can add some custom leaks checking by providing simple implementations for the allocation and deallocation functions. Write - this in a separate file: + this in a separate file fred.def: void *CreateFred() { @@ -586,12 +587,12 @@ void DestroyFred(void *p) Now, execute cppcheck this way: - cppcheck --append=fred.cpp fred1.cpp + cppcheck --include=fred.def fred1.c The output from cppcheck is: - Checking fred1.cpp... -[fred1.cpp:5]: (error) Memory leak: f + Checking fred1.c... +[fred1.c:5]: (error) Memory leak: f