rpl_malloc bug again

Matthias Andree matthias.andree at gmx.de
Wed Nov 6 12:48:33 CET 2002


Allyn Fratkin <allyn at fratkin.com> writes:

> this bug has been reported with bogofilter 0.8.0.rc1 when compiled on redhat 6.1:
> http://sourceforge.net/tracker/index.php?func=detail&aid=634148&group_id=62265&atid=499997
>
> there seem to be two issues:
> 1. for some reason, configure thinks malloc doesn't work on his system.
> 2. when that happens, configure #defines malloc to be rpl_malloc
>     (seems to be intended to mean "replacement malloc") but
>     rpl_malloc is not included in the distribution or cvs.

I killed the AC_FUNC_MALLOC and AC_FUNC_STAT tests that caused these
woes (and added a *path safeguard check along the lines of the
AC_FUNC_STAT), they're not going to buy us anything. The AC_FUNC_MALLOC
stuff is about making sure that we have malloc(0) succeed, but I don't
care. We should not do that, so if we kill a system with xmalloc(0)
dying, we at least know something is wrong and have the hope of getting
a stack backtrace and figure what's going on.

I did the same changes on the release branch and the main trunk.

> another user reported this on 10/29 and it looks like david temporarily
> reproduced it but then did "make clean; make" and the problem went away?
> (doesn't make sense).
>
> i don't find any mention of rpl_malloc in cvs, yet it is in 0.8.0.rc1.
> has this already been fixed?

Check "info autoconf", it has information on this and sample code, I
thought about adding this, but this would give us compiler warnings and
would require this config.h stuff all over the map, which I don't want
to do last-minute -- and I don't want that on the trunk either. It adds
unnecessary complexity for old systems, with their number decreasing.

Here's the rpl_malloc() code, brushed up a bit, it should be stored as
malloc.c (yes, without rpl_ in front) if we were to use it.

/* straight from autoconf manual */

#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc

#include <sys/types.h>

void *malloc(size_t size);

/* Allocate an N-byte block of memory from the heap.
 * If N is zero, allocate a 1-byte block.
 */

char *
rpl_malloc(size_t n)
{
    if (n == 0)
	n = 1;
    return malloc (n);
}


-- 
Matthias Andree



More information about the bogofilter-dev mailing list