Re: Memory Leak in Kpathsea

Karl Berry <[email protected]> Tue, 16 Jun 2026 14:50:29 -0600
Newsgroups gmane.comp.tex.live
Message-ID <[email protected]>
Hi Jonathan,

    Subject: Memory Leak in Kpathsea

Thanks for the report, but there are lots of (tiny) memory leaks in
kpathsea. I wrote it that way in the 1980s for simplicity, and because
the amount of memory lost was insignificant then. So it is even less
significant now, by several orders of magnitude.

I probably wouldn't do it the same way if I was starting from scratch
today, but trying to fix it now would cause a lot of instability and
possible crashes, for no meaningful benefit.  So I won't be making
changes in this regard.

    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.