cppcheck run against 1.27
chris ahrendt
celticht32 at yahoo.com
Sat Aug 8 17:06:50 CDT 2009
Marcus Meissner wrote:
> On Fri, Aug 07, 2009 at 06:36:36PM -0700, chris ahrendt wrote:
>
>> [../wine-git/dlls/ntdll/server.c:802]: (error) Resource leak: fd
>>
>
> I do not fully understand the code (keep fd open to have to lock
> existing?), but it is in a fatal exit path.
>
>> [../wine-git/tools/fnt2bdf.c:219]: (error) Resource leak: fp
>> [../wine-git/tools/fnt2bdf.c:653]: (error) Resource leak: fd
>>
>
> Fix submitted, seem necessary.
>
>
>> [../wine-git/tools/fnt2fon.c:304]: (error) Memory leak: file_lens
>>
>
> Fix submitted, but program is shortlived.
>
>
>> [../wine-git/tools/widl/write_msft.c:2540]: (error) Deallocating a
>> deallocated pointer: fd
>>
>
> I do not understand what it mislikes about it. I think the detection
> is wrong.
>
>
>> [../wine-git/tools/winebuild/res16.c:187]: (error) Resource leak: fd
>>
>
> Fix submitted. Small issue though.
>
>
>> [../wine-git/tools/winedump/pe.c:1549]: (error) Memory leak: map
>>
>
> Fix submitted. Small issue though.
>
> Ciao, Marcus
>
>
>
here is what its checking for :
Standard checks that are always used
* out of bounds
* Using 'memfunc' on class
* Using 'memfunc' on struct that contains a 'std::classname'
* Class Base which is inherited by class Derived does not have a
virtual destructor
* Mismatching allocation and deallocation: varname
* Memory leak <http://en.wikipedia.org/wiki/Memory_leak>: varname
* Resource leak <http://en.wikipedia.org/wiki/Resource_leak>: varname
* Deallocating a deallocated pointer: varname
* Using 'varname' after it is deallocated / released
* The given size sz is mismatching
* Invalid radix in call to strtol
<http://en.wikipedia.org/wiki/Strtol> or strtoul. Must be 0 or 2-36
* Overlapping data buffer varname
* Unsigned division. The result will be wrong.
* Unusual pointer arithmetic
* Returning pointer to local array variable
* Same iterator is used with both container1 and container2
* Dangerous usage of erase
* After push_back or push_front, the iterator 'iterator_name' may be
invalid
* Wrong assignment of an auto-variable to an effective parameter of
a function
* Return of the address of an auto-variable
* Division by zero
* STL <http://en.wikipedia.org/wiki/Standard_Template_Library>:
check usage of iterators after erase, as erase invalidates the
iterator
* STL: check usage of iterators and pointers after push_back and
push_front. If using a vector the iterator or pointer may become
invalid.
* STL: Range checks with iterators should use != instead of <
I have not run it with the following :
Extra checks that you enable with "--all" These checks are not part of
the standard checking because they produce false positives.
* Array index out of bounds
* Buffer overrun
* Dangerous usage of strncat <http://en.wikipedia.org/wiki/Strcat>,
possible buffer overrun
* Memory leak: varname
* The size argument is given as a char constant
Extra checks that you enable with "--style"
* The class 'classname' has no constructor
* Member variable not initialized in the constructor
'classname::varname'
* Unused private function 'classname::funcname'
* 'operator=' should return something
* C-style pointer casting
* Redundant condition. It is safe to deallocate a NULL pointer
* Redundant condition. The remove function in the STL will not do
anything if element doesn't exist
* Found redundant if condition - 'if (condition);'
* struct or union member 'structname::varname' is never used
* Function parameter 'parname' is passed by value. It could be
passed by reference instead.
* Redundant code: Found a statement that begins with type constant
* Warning - using char variable as array index
* Warning - using char variable in bit operation
* Condition is always truefalse
Checks that are enabled when both "--all" and "--style" is given
* Warning: Division with signed and unsigned operators
When giving "--unused-functions"
* The function 'funcname' is never used
I am going to start running with the --all flag going forward.
So the leak with fd cppcheck thinks that you have an exit path that will
leave the fd allocated still without freeing the resource.
[../wine-git/dlls/ntdll/server.c:802]: (error) Resource leak: fd so this exits without freeing the resource.
[../wine-git/tools/widl/write_msft.c:2540]: (error) Deallocating a
deallocated pointer: fd - This just means your freeing an already freed
resource... This is more of a warning than anything
Chris
More information about the wine-devel
mailing list