Remove unnecessary null pointer checks
Extra null pointer checks are not needed in functions like the following.
Would you like to apply the following semantic patch to find more update candidates?
@Remove_unnecessary_pointer_checks@
expression x;
@@
-if (x)
opj_free(x);
As of now opj_free is using just free(), but as you can imagine that can change, so if as of now free() by C standard is checking for NULL inside, it can be not as such in the future.
:crystal_ball: Will alternative implementations of the function “opj_free” tolerate also the passing of null pointers?
I do not know many *alloc() and friends implementations outside C library and now Microsoft's leaked one, I know they exist. For example, there is this implementation. https://github.com/google/tcmalloc
Do you expect null pointer tolerance for memory release functions?