[PATCH] newlib: libc: Fix memory leak in computematchjumps()

Kuan-Wei Chiu visitorckw@gmail.com
Sat Dec 2 04:13:25 GMT 2023


On Fri, Dec 01, 2023 at 03:08:30PM -0500, Mike Frysinger wrote:
> On 02 Dec 2023 00:13, Kuan-Wei Chiu wrote:
> > --- a/newlib/libc/posix/regcomp.c
> > +++ b/newlib/libc/posix/regcomp.c
> > @@ -2001,8 +2001,10 @@ struct re_guts *g;
> >  	}
> >  
> >  	g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
> > -	if (g->matchjump == NULL)	/* Not a fatal error */
> > -		return;
> > +	if (g->matchjump == NULL) { /* Not a fatal error */
> > +        free(pmatches);
> > +        return;
> > +    }
> 
> the code uses tabs for indentation, but you used spaces for some reason
> -mike

Hi Mike,

Thank you for reviewing the patch. I apologize for the oversight
regarding the indentation inconsistency—using spaces instead of tabs.

I will submit another patch that corrects the indentation.

Best regards,
Kuan-Wei Chiu



More information about the Newlib mailing list