Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
logportmap.c:413]: (style) Suspicious condition #93
Comments
|
Yup. (There's too much of that type of overly compacted pattern in the code for my taste.) |
|
Fixed upstream in my tree. |
kmcdonell
closed this
May 15, 2016
|
@dcb314 ... based on your other github postings, I'm guessing you have a tool that you use to find this class of problem. Is that so? And if so, have you run it across all of the PCP code and this is the only botch discovered in the process? Cheers and thanks. |
dcb314
commented
May 15, 2016
Yes, a static analyser called cppcheck, available from sourceforge.
Not sure, but certainly the PCP code that appears in Fedora Rawhide.
Oh no. There are many errors, warnings, style problems and performance problems Here are the errors: [p_result.c:207]: (error) Uninitialized variable: pp The warnings: [p_result.c:235]: (warning) Suspicious code: sign conversion of - in calculation There are 33 style warnings, too many to list here. |
|
Unfortunately, the 4 "errors" above are all false positives ... so I'm not sure how much trust I'd place in cppcheck. |
|
The util.c:1796 memory leak seems legit; if names = realloc() succeeds but the [n-1]=malloc() fails, then names[] is unfreed. Similarly, logutil.c:1516, that error could result in pr being unfreed. |
|
OK Frank ... the util.c one also means I should first free names[j] ... 0<=j<n-1 and then free names ... but this is a bit Nero-like in as much as the inner malloc() failing probably means the sky is about to fall in, so tossing a few bytes back into the pool probably won't prevent the end of the world. The logutil.c one is legit, I agree. |
dcb314
commented
May 16, 2016
It's not perfect, but I find that anything it has got to say is usually worth looking at more closely. Flag --enable=all makes it say more than the default setting. |
dcb314 commentedMay 14, 2016
Source code is
Maybe better code