apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fritsch ...@sfritsch.de>
Subject cppcheck fixes
Date Mon, 05 Apr 2010 21:59:02 GMT

I have tried the cppcheck static code analyzer on apr trunk and it 
found some errors that may be worth fixing. For some, I have attached 
a patch. These two I think are false positives/intentional:

[./dso/win32/dso.c:133]: (error) Uninitialized variable: rv
[./misc/unix/otherchild.c:85]: (error) Possible null pointer 
dereference: cur

I haven't looked at the rest:

[./build/aplibtool.c:379]: (error) Memory leak: newarg
[./build/aplibtool.c:637]: (error) Resource leak: dir
[./build/jlibtool.c:978]: (error) Memory leak: path
[./build/jlibtool.c:1775]: (error) Memory leak: cctemp
[./build/jlibtool.c:1961]: (error) Resource leak: dir
[./build/jlibtool.c:1653]: (error) Data is allocated but not 
initialized: newpath
[./test/testbuckets.c:108]: (error) Undefined behaviour: msg is used 
wrong in call to sprintf or snprintf. Quote: If copying takes place 
between objects that overlap as a result of a call to sprintf() or 
snprintf(), the results are undefined.

Given the relatively low rate of false positives, I think cppcheck is 
a nice tool.


View raw message