summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorOmar Polo <op@cvs.openbsd.org>2023-03-22 18:18:36 +0000
committerOmar Polo <op@cvs.openbsd.org>2023-03-22 18:18:36 +0000
commitcd04920052138ba80299c994d3a406cb1ed9548c (patch)
tree5cfeba11825bf307df08c69d0b927c6faefdb6e0 /usr.bin/mg
parentf3c9bd0bef60815247db3854e584ae114e2fd9f0 (diff)
plug memleak in error path
based on a diff by lux (lx [at] shellcodes [dot] org), thanks! Diff via, tweak and ok tb@
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/tags.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c
index 7bf0e91993d..44311120ae8 100644
--- a/usr.bin/mg/tags.c
+++ b/usr.bin/mg/tags.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tags.c,v 1.20 2023/03/22 18:10:07 op Exp $ */
+/* $OpenBSD: tags.c,v 1.21 2023/03/22 18:18:35 op Exp $ */
/*
* This file is in the public domain.
@@ -369,12 +369,12 @@ strip(char *s, size_t len)
int
addctag(char *l)
{
- struct ctag *t;
+ struct ctag *t = NULL;
if ((t = malloc(sizeof(struct ctag))) == NULL) {
dobeep();
ewprintf("Out of memory");
- return (FALSE);
+ goto cleanup;
}
t->tag = l;
if ((l = strchr(l, '\t')) == NULL)