Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Fix source of memory leak in halcmd_main #1158

Merged
merged 1 commit into from Mar 1, 2017
Merged

Fix source of memory leak in halcmd_main #1158

merged 1 commit into from Mar 1, 2017

Conversation

ArcEye
Copy link

@ArcEye ArcEye commented Mar 1, 2017

The service_uuid char * is strdup() from the ini file entry string
but this is not freed anywhere.
Add cleanup() function to test and free where appropriate.
Call this function before returns.

Output from valgrind before amendments
==21671== LEAK SUMMARY:
==21671== definitely lost: 37 bytes in 1 blocks
==21671== indirectly lost: 0 bytes in 0 blocks
==21671== possibly lost: 12,657 bytes in 203 blocks
==21671== still reachable: 76,524 bytes in 413 blocks

Output after amendments
==23009== LEAK SUMMARY:
==23009== definitely lost: 0 bytes in 0 blocks
==23009== indirectly lost: 0 bytes in 0 blocks
==23009== possibly lost: 12,657 bytes in 203 blocks
==23009== still reachable: 76,524 bytes in 413 blocks

Signed-off-by: Mick arceye@mgware.co.uk

The service_uuid char * is strdup() from the ini file entry string
but this is not freed anywhere.
Add cleanup() function to test and free where appropriate.
Call this function before returns.

Output from valgrind before amendments
==21671== LEAK SUMMARY:
==21671==    definitely lost: 37 bytes in 1 blocks
==21671==    indirectly lost: 0 bytes in 0 blocks
==21671==      possibly lost: 12,657 bytes in 203 blocks
==21671==    still reachable: 76,524 bytes in 413 blocks

Output after amendments
==23009== LEAK SUMMARY:
==23009==    definitely lost: 0 bytes in 0 blocks
==23009==    indirectly lost: 0 bytes in 0 blocks
==23009==      possibly lost: 12,657 bytes in 203 blocks
==23009==    still reachable: 76,524 bytes in 413 blocks

Signed-off-by: Mick <arceye@mgware.co.uk>
@ArcEye
Copy link
Author

ArcEye commented Mar 1, 2017

Unfortunately this is not the memory leak causing #1123 (comment)

I found it whilst looking for that leak, this one has been around for a long time I think.

@cdsteinkuehler cdsteinkuehler merged commit f3c63e5 into machinekit:master Mar 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants