cppcheck errors

Martin Galvan martin.galvan at tallertechnologies.com
Tue Sep 1 19:10:52 UTC 2015

Hi everyone!

I just ran CppCheck again on a fresh clone of the git repo and saw the
number of error reports was quite smaller than what I reported before.
That's because my previous run was on a (quite older) version; most of
those must've been fixed already.

Some of the error reports remain, though. I opened a ticket for that
and will send a patch that fixes the issues Joel mentioned as worth
looking at. I'll open separate tickets for issues reported as
"warning" and "portability" (such as the void * thing), and send their
respective patches when they're done.

While working the fixes I noticed that the following error:

[cpukit/librpc/src/rpc/netnamer.c:331]: (error) Resource leak: fd

seems to be a false positive. getnetid will be stuck in an endless for
loop until it exits through one of the return statements; all of them
seem to have their corresponding fclose (if necessary).

I also noticed some new error reports. It would be nice if Joel (or
anyone else who knows the code base better than me) took a look at
these and pointed out which ones are third-party code:

[cpukit/libfs/src/dosfs/msdos_format.c:1105]: (error) Uninitialized
struct member: fmt_params.mbr_copy_sec
[cpukit/libfs/src/nfsclient/src/rpcio.c:1203]: (error) Uninitialized
variable: stat
[cpukit/libmisc/shell/print-ls.c:108]: (error) Invalid number of
character ({) when these macros are defined: 'RTEMS_REMOVED'.
[cpukit/libnetworking/libc/getifaddrs.c:251]: (error) Deallocation of
an auto-variable results in undefined behaviour.
[cpukit/libnetworking/libc/getifaddrs.c:256]: (error) Deallocation of
an auto-variable results in undefined behaviour.
[cpukit/libnetworking/net/radix.c:935]: (error) Uninitialized variable: error
[cpukit/libnetworking/net/radix.c:977]: (error) Uninitialized variable: error
[cpukit/libnetworking/netinet/in.c:647]: (error) Memory leak: inm
[cpukit/libnetworking/netinet/ip_fw.c:690]: (error) Memory leak: fwc
[cpukit/mghttpd/mongoose.c:2811] -> [cpukit/mghttpd/mongoose.c:1221]:
(error) Mismatching allocation and deallocation: dir
[cpukit/mghttpd/mongoose.c:2852] -> [cpukit/mghttpd/mongoose.c:1221]:
(error) Mismatching allocation and deallocation: dir

More information about the devel mailing list