Memory leak fix and correction for point to stack location returned from function#273
Merged
Merged
Conversation
Each time ledmon is looping we end up going through block_device_init which internally is calling _get_host. Get host returns a string that is on the heap and must be freed. It is being freed in the error path, but not in the good path. Leak is dependent on the number of block devices. Signed-off-by: Tony Asleson <tasleson@redhat.com>
vmdssd_get_domain() returned a pointer into a stack-local buffer (real_domain_path) via strtok(basename(...)). The caller in cntrl_device_init() reads from this dangling pointer. Fix by returning a strdup'd copy and freeing it in the caller. This is likely working as the data on the stack isn't getting cleared/ overwritten. Signed-off-by: Tony Asleson <tasleson@redhat.com>
mtkaczyk
approved these changes
Apr 9, 2026
bkucman
approved these changes
Apr 9, 2026
bkucman
left a comment
Collaborator
There was a problem hiding this comment.
No response in the ISSUE. In my opinion, it looks good, worth merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hopefully this resolves: #178
I've only compiled this. It would be great if we could get an updated binary to reporting user for verification.