[PATCH] newlib: libc: Fix memory leak in computematchjumps()
Mike Frysinger
vapier@gentoo.org
Fri Dec 1 20:08:30 GMT 2023
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20231201/ce1ebafd/attachment.sig>
More information about the Newlib
mailing list