Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfishpower: fix memleaks and test under valgrind #169

Merged
merged 4 commits into from
Mar 28, 2024

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Mar 27, 2024

TSIA

Note, can be reviewed indepedently of #167 and #168

Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Comment on lines 374 to 379
if (pm->hostname)
xfree(pm->hostname);
if (pm->plugname)
xfree(pm->plugname);
if (pm->parent)
xfree(pm->parent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checks for non-NULL are unnecessary.

Problem: Checking for NULL before calling xfree() is unnecessary.

Remove unnecessary checks.
Problem: A few fields in the power message struct are not freed
on destruction.

Free memory of appropriate fields on destruction.
Problem: A cut and paste error has lead to the waitcmds list not
calling a destructor when items on the list are removed.

Set the destructor on the correct list.
Problem: There is no coverage for memory leaks in redfishpower.

Add memleak test in t0034-redfishpower.t test file.

Fixes chaos#166
@chu11
Copy link
Member Author

chu11 commented Mar 28, 2024

thanks. re-pushed with an extra commit to cleanup those unnecessary NULL checks and adjusted commit as well.

@garlick
Copy link
Member

garlick commented Mar 28, 2024

Feel free to set MWP when you're done.

@mergify mergify bot merged commit 49d9576 into chaos:master Mar 28, 2024
8 checks passed
@chu11 chu11 deleted the redfishpower_valgrind branch April 4, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants