summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-01-22 09:41:55 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-01-22 09:41:55 +0000
commit2b8885f82a51e529313aa8e9bfbc1c2a46c70b27 (patch)
tree78baf8a3eb53578f3b1b73a730279f7f6ea8510b /usr.bin
parent89a70b3880b65a1ef6f10394c9970319e6781f07 (diff)
fix a leak in an error path
ok krw@ deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/less/regexp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/less/regexp.c b/usr.bin/less/regexp.c
index 8d221ae1d0d..9fd72e1991d 100644
--- a/usr.bin/less/regexp.c
+++ b/usr.bin/less/regexp.c
@@ -242,8 +242,10 @@ char *exp;
regnpar = 1;
regcode = r->program;
regc(MAGIC);
- if (reg(0, &flags) == NULL)
+ if (reg(0, &flags) == NULL) {
+ free(r);
return(NULL);
+ }
/* Dig out information for optimizations. */
r->regstart = '\0'; /* Worst-case defaults. */