aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/posix/regcomp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/newlib/libc/posix/regcomp.c b/newlib/libc/posix/regcomp.c
index 002f978..e71bc00 100644
--- 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;
+ }
/* Set maximum possible jump for each character in the pattern */
for (mindex = 0; mindex < g->mlen; mindex++)