Hi Laslo,

On Sun, Jun 26, 2022 at 11:16:32PM +0200, Laslo Hunhold wrote:
> come on, it is general knowledge that free() accepts NULL arguments.

I don't think that's a true. If it were general knowledge then we
wouldn't see the pattern of `if (ptr) free(ptr)` in the code to begin
with.

And overall, I don't believe most "resource-release" functions have this
behavior. For example fclose, closedir, munmap etc don't accept NULL
arg. So `free` is more of an exception to the general knowledge.

- NRK

Reply via email to