[PC-BSD Dev] cppcheck and co.

Yuri Momotiuk yurkis at gmail.com
Sat Feb 25 08:37:38 PST 2012


I have just run cppcheck on src-qt4 dir and got:

[pc-netmanager/src/NetworkManager/networkman.cpp:532]: (error) Mismatching
allocation and deallocation: file
[pc-netmanager/src/ethernetconfig/ethernetconfig.cpp:273]: (error)
Mismatching allocation and deallocation: file
[pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp:687]: (error)
Mismatching allocation and deallocation: file
[pc-pbigui/pbi.cpp:361]: (error) Mismatching allocation and deallocation:
file
[pc-pfmanager/config/interfaces.cpp:53]: (error) Resource leak: file
[pc-sounddetect/sound_detect.c:150]: (error) Resource leak: inF
[pc-sysmanager/cvsupprogress.cpp:265]: (error) Uninitialized variable:
nullBox

Also I saw some potential bugs in code for config files analyze:
For example line from Utils.cpp (libpcbsd)

*if ( line.indexOf("#", 0) == 0 || line.indexOf(Key, 0) == -1 ||
line.indexOf(Key, 0) > 0)*

should be like this:

*if ( line.trimmed().indexOf("#", 0) == 0 || line.indexOf(Key, 0) == -1 ||
line.indexOf(Key, 0) > 0)*

Otherwise code can not catch comment if there is space between "#" in line.
Please recheck related code.

-- 
Best regards, Yuri Momotyuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pcbsd.org/pipermail/dev/attachments/20120225/f348f08b/attachment.html>


More information about the Dev mailing list