[tex-k] Minor memory leak in kpathsea and a patch

Karl Berry karl at freefriends.org
Wed Nov 27 23:23:36 CET 2019

Hi - thanks for the report and patch. Kpathsea has always had memory
leaks, primarily wrt concatenating small strings. I wrote it that way
for maintainability and simplicity of the source code. (And yes, it has
been brought up before. :) I might do it differently today, but such is life.

The actual amount of leaked memory was not a problem in 1988, and so it's
even less of a problem now. The only "problem" is with valgrind and other
tools that want to account for every single byte. The right solution is
to configure valgrind not to care about kpathsea's memory "problems".

The patch is appreciated, but I don't want to blindly throw a bunch of
free()s into code that has been around for this long.  Every change
would have to be carefully considered. Sorry, but I have too many other
things on which to spend my TeX time for that to be a priority.

All the best,

More information about the tex-k mailing list