Closed elfring closed 10 years ago
Happy to merge a PR for this.
Why did you close this bug report before the affected source code will eventually be improved?
I closed it because there's no 'bug' here. Sure we don't need to check for null before calling free(), but it has no effect on the code. If you want to fix all the instances and make a PR I'll merge it.
Unnecessary checks can have unwanted run time consequences.
How do you think about to try out the tool "Coccinelle" also on your own for such a simple use case?
What unwanted run time consequence is
if (p) {
free(p);
}
going to have over
free(p);
?
Do implementation details like the following matter here?
I prefer free(p)
to if (p) free(p);
as well. There's no reason for extra code already covered by the language semantics.
Fixed.
Thanks for your small source code improvement.
An extra null pointer check is not needed in functions like the following.
Would you like to apply the following semantic patch to find more update candidates?