summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-01-03 19:51:15 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-01-03 19:51:15 +0000
commit8481a3387e7441cf0878a20c61932e3e611b631a (patch)
tree4f2bd9b47cb4f582be68f57c7b420539704ab43e /lib/libc
parent64c489379876c06e2430eff5b3c7b48269f257fc (diff)
Plug a mem leak. Now you can run hanoi.sed witt a lot of pegs and not
run out of mem! From FreeBSD PR 75656. ok millert@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/regex/engine.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 09f8cb2bce1..466a8208e88 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.13 2004/11/30 17:04:23 otto Exp $ */
+/* $OpenBSD: engine.c,v 1.14 2005/01/03 19:51:14 otto Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
@@ -36,7 +36,7 @@
*/
#if defined(SNAMES) && defined(LIBC_SCCS) && !defined(lint)
-static char enginercsid[] = "$OpenBSD: engine.c,v 1.13 2004/11/30 17:04:23 otto Exp $";
+static char enginercsid[] = "$OpenBSD: engine.c,v 1.14 2005/01/03 19:51:14 otto Exp $";
#endif /* SNAMES and LIBC_SCCS and not lint */
/*
@@ -184,6 +184,8 @@ matcher(struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[],
for (;;) {
endp = fast(m, start, stop, gf, gl);
if (endp == NULL) { /* a miss */
+ free(m->pmatch);
+ free(m->lastpos);
STATETEARDOWN(m);
return(REG_NOMATCH);
}