-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
src/redfishpower/redfishpower.c
Outdated
if (pm->hostname) | ||
xfree(pm->hostname); | ||
if (pm->plugname) | ||
xfree(pm->plugname); | ||
if (pm->parent) | ||
xfree(pm->parent); |
There was a problem hiding this comment.
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
4c77ccf
to
7cf939d
Compare
thanks. re-pushed with an extra commit to cleanup those unnecessary NULL checks and adjusted commit as well. |
Feel free to set MWP when you're done. |
TSIA
Note, can be reviewed indepedently of #167 and #168