Memory leak + error + perfomance notice #20

Closed
ghost opened this Issue Feb 15, 2013 · 1 comment

Projects

None yet

1 participant

@ghost
ghost commented Feb 15, 2013
[examples/cc/qfssample_main.cc:249]: (error) Memory leak: dataBuf
[benchmarks/mstress/mstress_client.cc:100]: (error) Common realloc mistake: 'actualPath_' nulled but not freed upon failure
[src/cc/access/kfs_module_py.cc:221] -> [src/cc/access/kfs_module_py.cc:212]: (error, inconclusive) Possible null pointer dereference: self - otherwise it is redundant to check it against null.
[src/cc/access/kfs_module_py.cc:750]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/ClientSM.cc:262] -> [src/cc/chunk/ClientSM.cc:278]: (error) Possible null pointer dereference: op - otherwise it is redundant to check it against null.
[src/cc/chunk/ClientSM.cc:687]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/ClientSM.cc:763]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/ChunkManager.cc:2232]: (error) Possible null pointer dereference: cih
[src/cc/chunk/KfsOps.cc:1526] -> [src/cc/chunk/KfsOps.cc:1528]: (performance) Variable 'needToForward' is reassigned a value before the old one has been used.
[src/cc/chunk/KfsOps.cc:1762]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/chunk/KfsOps.cc:2217]: (performance) Possible inefficient checking for 'checksum' emptiness.
[src/cc/chunk/KfsOps.cc:2423]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/chunk/chunkserver_main.cc:252] -> [src/cc/chunk/chunkserver_main.cc:249]: (error, inconclusive) Possible null pointer dereference: sInstance - otherwise it is redundant to check it against null.
[src/cc/common/Properties.cc:339]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/common/Properties.cc:362]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/fuse/kfs_fuse_main.cc:362] -> [src/cc/fuse/kfs_fuse_main.cc:360]: (error, inconclusive) Possible null pointer dereference: cp - otherwise it is redundant to check it against null.
[src/cc/emulator/LayoutEmulator.cc:353]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/emulator/LayoutEmulator.cc:384]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/kfsio/IOBuffer.cc:1011] -> [src/cc/kfsio/IOBuffer.cc:1005]: (error, inconclusive) Possible null pointer dereference: sIOBufferAllocator - otherwise it is redundant to check it against null.
[src/cc/kfsio/checksum.cc:206]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/libclient/FileOpener.cc:487] -> [src/cc/libclient/FileOpener.cc:471]: (error, inconclusive) Possible null pointer dereference: mCurOpPtr - otherwise it is redundant to check it against null.
[src/cc/libclient/KfsOps.cc:491]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/libclient/KfsOps.cc:523]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/libclient/Path.cc:127]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/libclient/WriteAppender.cc:1337] -> [src/cc/libclient/WriteAppender.cc:1316]: (error, inconclusive) Possible null pointer dereference: mCurOpPtr - otherwise it is redundant to check it against null.
[src/cc/libclient/KfsClient.cc:94] -> [src/cc/libclient/KfsClient.cc:96]: (performance) Variable 'verbose' is reassigned a value before the old one has been used.
[src/cc/meta/ChunkPlacement.h:225]: (error) Analysis failed. If the code is valid then please report this failure.
[src/cc/meta/LayoutManager.cc:4539] -> [src/cc/meta/LayoutManager.cc:4536]: (error, inconclusive) Possible null pointer dereference: cs - otherwise it is redundant to check it against null.
[src/cc/qcdio/qcunittest_main.cc:148]: (performance) Function parameter 'inStatus' should be passed by reference.
[src/cc/tests/dirfile_test_main.cc:180] -> [src/cc/tests/dirfile_test_main.cc:181]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/dirfile_test_main.cc:210] -> [src/cc/tests/dirfile_test_main.cc:211]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/reader_test_main.cc:94] -> [src/cc/tests/reader_test_main.cc:95]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/seekwrite_test_main.cc:131] -> [src/cc/tests/seekwrite_test_main.cc:132]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/truncate_test_main.cc:119] -> [src/cc/tests/truncate_test_main.cc:120]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/writer_test_main.cc:119] -> [src/cc/tests/writer_test_main.cc:120]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tools/kfsmkdirs.cc:42]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfspwd.cc:43]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsls.cc:84]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsls.cc:89]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsrm.cc:45]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsrmdir.cc:42]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/qfsping_main.cc:58]: (performance) Possible inefficient checking for 'upServers' emptiness.
[src/cc/tools/qfsping_main.cc:66]: (performance) Possible inefficient checking for 'downServers' emptiness.
Contributor
gofish commented Feb 15, 2013

Thanks for your comments.

[benchmarks/mstress/mstress_client.cc:100]: (error) Common realloc mistake: 'actualPath_' nulled but not freed upon failure```

I see this with C++ programmers all the time, and it bugs me to no end. Using a vector instead.

[src/cc/chunk/ClientSM.cc:262] -> [src/cc/chunk/ClientSM.cc:278]: (error) Possible null pointer dereference: op - otherwise it is redundant to check it against null.
[src/cc/emulator/LayoutEmulator.cc:353]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/emulator/LayoutEmulator.cc:384]: (performance) Prefer prefix ++/-- operators for non-primitive types.

Hmm, assert() is used to prevent it, which is problematic if NDEBUG . Will now return -1;

[examples/cc/qfssample_main.cc:249]: (error) Memory leak: dataBuf

Sure, it could be deleted before the exit from main().

The rest aren't very useful. What lint are you using?

[src/cc/meta/ChunkPlacement.h:225]: (error) Analysis failed. If the code is valid then please report this failure.

Report this failure.

[src/cc/access/kfs_module_py.cc:221] -> [src/cc/access/kfs_module_py.cc:212]: (error, inconclusive) Possible null pointer dereference: self - otherwise it is redundant to check it against null.

Not a null deference. The function returns NULL.

[src/cc/chunk/ChunkManager.cc:2232]: (error) Possible null pointer dereference: cih

Not per the contract of GetChunkInfoHandle()

[src/cc/chunk/chunkserver_main.cc:252] -> [src/cc/chunk/chunkserver_main.cc:249]: (error, inconclusive) Possible null pointer dereference: sInstance - otherwise it is redundant to check it against null.

Can't have a null dereference after an abort().

[src/cc/fuse/kfs_fuse_main.cc:362] -> [src/cc/fuse/kfs_fuse_main.cc:360]: (error, inconclusive) Possible null pointer dereference: cp - otherwise it is redundant to check it against null.

Can't have a null dereference after an exit().

[src/cc/kfsio/IOBuffer.cc:1011] -> [src/cc/kfsio/IOBuffer.cc:1005]: (error, inconclusive) Possible null pointer dereference: sIOBufferAllocator - otherwise it is redundant to check it against null.
[src/cc/libclient/FileOpener.cc:487] -> [src/cc/libclient/FileOpener.cc:471]: (error, inconclusive) Possible null pointer dereference: mCurOpPtr - otherwise it is redundant to check it against null.
[src/cc/libclient/WriteAppender.cc:1337] -> [src/cc/libclient/WriteAppender.cc:1316]: (error, inconclusive) Possible null pointer dereference: mCurOpPtr - otherwise it is redundant to check it against null.
[src/cc/meta/LayoutManager.cc:4539] -> [src/cc/meta/LayoutManager.cc:4536]: (error, inconclusive) Possible null pointer dereference: cs - otherwise it is redundant to check it against null.

Not a null dereference. Uses a conditional operator to check for NULL.

[src/cc/access/kfs_module_py.cc:750]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/ClientSM.cc:687]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/ClientSM.cc:763]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/common/Properties.cc:339]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/common/Properties.cc:362]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/kfsio/checksum.cc:206]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/libclient/Path.cc:127]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[src/cc/chunk/KfsOps.cc:1526] -> [src/cc/chunk/KfsOps.cc:1528]: (performance) Variable 'needToForward' is reassigned a value before the old one has been used.
[src/cc/libclient/KfsClient.cc:94] -> [src/cc/libclient/KfsClient.cc:96]: (performance) Variable 'verbose' is reassigned a value before the old one has been used.
[src/cc/qcdio/qcunittest_main.cc:148]: (performance) Function parameter 'inStatus' should be passed by reference.
[src/cc/tests/dirfile_test_main.cc:180] -> [src/cc/tests/dirfile_test_main.cc:181]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/dirfile_test_main.cc:210] -> [src/cc/tests/dirfile_test_main.cc:211]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/reader_test_main.cc:94] -> [src/cc/tests/reader_test_main.cc:95]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/seekwrite_test_main.cc:131] -> [src/cc/tests/seekwrite_test_main.cc:132]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/truncate_test_main.cc:119] -> [src/cc/tests/truncate_test_main.cc:120]: (performance) Buffer 'fileName' is being written before its old content has been used.
[src/cc/tests/writer_test_main.cc:119] -> [src/cc/tests/writer_test_main.cc:120]: (performance) Buffer 'fileName' is being written before its old content has been used.

Insignificant micro-optimizations.

[src/cc/chunk/KfsOps.cc:1762]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/chunk/KfsOps.cc:2217]: (performance) Possible inefficient checking for 'checksum' emptiness.
[src/cc/chunk/KfsOps.cc:2423]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/libclient/KfsOps.cc:491]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/libclient/KfsOps.cc:523]: (performance) Possible inefficient checking for 'checksums' emptiness.
[src/cc/tools/kfsmkdirs.cc:42]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfspwd.cc:43]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsls.cc:84]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsls.cc:89]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsrm.cc:45]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/kfsrmdir.cc:42]: (performance) Possible inefficient checking for 'args' emptiness.
[src/cc/tools/qfsping_main.cc:58]: (performance) Possible inefficient checking for 'upServers' emptiness.
[src/cc/tools/qfsping_main.cc:66]: (performance) Possible inefficient checking for 'downServers' emptiness.

Not for a vector.

@ghost ghost closed this Feb 16, 2013
@gofish gofish pushed a commit that referenced this issue Feb 22, 2013
Jeremy R. Fishman Merge branch 'dev/lint'. Closes #20. e326f97
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment