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

Erik Andersen andersen at codepoet.org
Mon Nov 19 04:15:02 UTC 2001


On Mon Nov 19, 2001 at 11:34:37AM +0100, Neal H Walfield wrote:
> >         while (--nregexes >= 0) {
> >                 regfree(&regexes[nregexes]);
> >                 free(&regexes[nregexes]);
> >         }
> 
> Freeing the address of a variable is suspect.  In fact, I have trouble
> imagining how you could ever create an array like this.  Should this
> not be: `free (regexes[nregexes])'?

I just fixed this up.  Also, regexes is a single buffer, and so
should be freed just once.  I moved it after the while loop as just 
if (regexes)
    free(regexes);

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--






More information about the busybox mailing list