Re: Memory Leak in Kpathsea

Patrice Dumas <[email protected]> Tue, 16 Jun 2026 23:26:03 +0200
Newsgroups gmane.comp.tex.live
Message-ID <[email protected]>
On Tue, Jun 16, 2026 at 02:50:29PM -0600, Karl Berry wrote:
>     calling free upon a null pointer is a no-op. 
> 
> So far as I know, that is not guaranteed. Maybe some standard says so
> today, but in practice, at least in the past, free(NULL) could cause an
> abort. I don't remember the systems; maybe they are all gone by
> now. --best, karl.

It is in POSIX 2001
https://pubs.opengroup.org/onlinepubs/009695399/functions/free.html
"If ptr is a null pointer, no action shall occur.".  I think that it is
pretty normal nowadays to call free on a NULL pointer, as the platforms
that aborted are probably long gone now, as you say.

-- 
Pat