malloc() with out free() in popt (2.4.7pre)
mbp at valinux.com
Fri Aug 17 21:43:24 EST 2001
On 13 Aug 2001, "John E. Malmberg" <malmberg at Encompasserve.org> wrote:
> I am still chasing this down, but in doing the build for OpenVMS,
> I have discovered that one of the popt modules is using HAVE_ALLOCA_H
> to determine if the alloca function is on a platform.
> That is not a good assumption. Compaq C does have an alloca() built in
> (slightly different symbol name, I assume because of symbol naming rules
> in the C standard.)
> Because alloca is a non-standard extension, if present it may not be in
> an alloca.h header, it could be in a different header.
> HAVE_ALLOCA_H should only decide if the code should #include <alloca.h>.
> HAVE_ALLOCA should decide if the alloca built-in equivalent function
> should be used.
> The more serious apparent bug, is that malloc() is being substituted for
> alloca() in the case that alloca.h is not present.
OK, good catch.
> No free() call seems to be done.
> Therefore the memory malloc() is lost until the program exits.
Since popt is only called once (conceptually) at startup, I'd expect
it to use a small, fixed amount of memory. I could be wrong.
We should run under ccmalloc sometime. That would be entertaining.
The build farm already runs rsync under Insure++, but the test suite
doesn't give it much exercise.
More information about the rsync