Re: [hackers] [sent] [PATCH 1/3] sent.c: Drop unnecessary NULL checks

From: NRK <nrk_AT_disroot.org>
Date: Mon, 4 Jul 2022 14:19:44 +0600

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
Received on Mon Jul 04 2022 - 10:19:44 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 04 2022 - 10:24:29 CEST