Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#5 AIX: malloc(0) returns NULL patch

closed-fixed
nobody
None
5
2002-12-06
2002-12-04
Mats Rynge
No

Hi!

This is a patch for AIX, under which malloc(0) returns
NULL and by that giving false out of memory messages.

The patch should also work on other systems that has
this problem with malloc. It uses the AC_FUNC_MALLOC
macro and defines malloc as rpl_malloc, which is
implemented in the added malloc_replacements.c file.

Thanks,

/Mats

Discussion

  • Mats Rynge
    Mats Rynge
    2002-12-04

    malloc_replacements patch

     
  • Logged In: YES
    user_id=2788

    Thanks for the patch, I'll merge it.

    Is there a precedence case, possibly with backtrace, when
    your bogofilter-on-AIX choked that way?

     
    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=2788

    I actually did not merge the patch, but inlined its idea into
    xmalloc.c and xcalloc.c (in CVS now): when malloc or calloc
    returns NULL and the size was also 0, retry with size 1. Saves
    us one level of indirection on broken systems, i. e. function
    call overhead, and with a reasonable C optimizer, it should not
    cost any more on systems with working malloc(0).

    Thanks nonetheless, it was a clean patch!

     
  • Mats Rynge
    Mats Rynge
    2002-12-08

    Logged In: YES
    user_id=661725

    Thanks for being so responsive!

    I have verified that cvs works on AIX 4.3.