Citeren Jonas Gorski <jonas.gor...@gmail.com>:

On 11 December 2017 at 10:04, Rosen Penev <ros...@gmail.com> wrote:
Mainly plugging memory leaks. Size reduction as well. The calloc change accounts for 272 bytes on this machine for some reason...

Please state the exact errors found by cppcheck so we don't have to
guess what it found.

I tried to replicate what Rosen did, but in my case cppcheck came up with only two errors:

    [libfstools/rootdisk.c:175]: (error) Resource leak: f
    [libfstools/ubi.c:72]: (error) Resource leak: f

These look like actual leaks, so this *may* be worth fixing. It could also be the conditions never occur (so these never leak anything). The proposed changes for these two errors look sane though.

[block.c:1087] -> [block.c:1091]: (warning) Either the condition '!pr' is redundant or there is possible null pointer dereference: pr.

This one has merit too. There is no point in doing a NULL pointer check after using that pointer a few lines before.

    [blockd.c:119]: (warning) Possible null pointer dereference: device
    [blockd.c:127]: (warning) Possible null pointer dereference: device
    [blockd.c:130]: (warning) Possible null pointer dereference: device

I'm not so sure about these warnings. It doesn't seem possible that *both* device_n and device_o are NULL, which would be required to actually cause a NULL pointer dereference here. This might be fixed cleaner by changing

   211          } else {

to

   211          } else if (device_o) {

The remainder of the warnings might be 'fixed' to shut-up cppcheck, but don't actually change anything.


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to