[BusyBox] bug#1223: BusyBox] bug#1223: grep segfaults with multiple regexps and CLEAN_UP enabled

Neal H Walfield neal at cs.uml.edu
Mon Nov 19 05:29:25 UTC 2001


>> Have you referred him to the standard?
>>
> His comments stand for themselves, from the settings.dist file.
>
>  * Should we allow the free of a NULL pointer and if it happens,
>  * should a message be generated to that effect.  Most (if not all)
>  * POSIX C libraries allow you to free() or delete() a NULL pointer
>  * and a number of programming reference manuals mention that freeing
>  * of NULL is ``allowed''.  However, I believe that it is bad form,
>  * promotes lazy pointer handling, and can often hide program bugs.
>  * As the author of dmalloc, I reserve the right to determine the
>  * default action of the library to encourage code similar to the
>  * following: if (pnt != NULL) { free(pnt); }

Unfortunate.  Standards are there to void portability problems, I fail
to understand why people try to create them.  Not to mention that his
goal could be satisfied by using a simple malloc debugger such as the
one that comes with glibc.

Two things: Does he claim that dmalloc is a POSIX compatible
implementation of malloc?  Secondly, that failing, could you confirm
that this works:

        void *p = malloc (0);
        assert (p != 0);

If it does not, then his logic is not that consistent and someone
should complain.

Thanks.





More information about the busybox mailing list