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

Glenn McGrath bug1 at optushome.com.au
Mon Nov 19 01:45:03 UTC 2001


On Mon, 19 Nov 2001 19:04:11 +1100
"Steve Merrifield" <steve at labyrinth.net.au> wrote:

> If I comment out the free() it works fine.  Why? I've been down
several
> paths - printing allocated/deallocated addresses, not using realloc in
> add_regex(), but using malloc(big) in main etc... (I initially thought
> it was trying to free a non-allocated block, but my tests without
> realloc
> and using malloc(big) show this not to be the case).
>  

One thing to be aware of is if you compiled it with dmalloc then its a
fatal error to free a NULL pointer.

If this is the problem you can surround the free statement with an if.
i.e.

if (ptr) {
	free(ptr);
}

increases binary size though, dmalloc can be recompiled to only give a
warning.

Glenn

	






More information about the busybox mailing list