summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/regcomp.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-12-19 06:48:47 +0000
committerdelphij <delphij@FreeBSD.org>2014-12-19 06:48:47 +0000
commit6227a44c223f61d30343a8d2a964d2cd98ac01cc (patch)
tree4c979a24e37d4c480cbdc76e75790ee1ce9bc4ec /lib/libc/regex/regcomp.c
parent0ce49065dba0bda45fb8f00f3a2ff42f4565f3ea (diff)
downloadFreeBSD-src-6227a44c223f61d30343a8d2a964d2cd98ac01cc.zip
FreeBSD-src-6227a44c223f61d30343a8d2a964d2cd98ac01cc.tar.gz
Plug a memory leak.
Obtained from: DragonFlyBSD (commit 5119ece) MFC after: 2 weeks
Diffstat (limited to 'lib/libc/regex/regcomp.c')
-rw-r--r--lib/libc/regex/regcomp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index a01bb95..2ecb88c 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1716,8 +1716,10 @@ computematchjumps(struct parse *p, struct re_guts *g)
}
g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
- if (g->matchjump == NULL) /* Not a fatal error */
+ 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++)
OpenPOWER on IntegriCloud