From cd04920052138ba80299c994d3a406cb1ed9548c Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Wed, 22 Mar 2023 18:18:36 +0000 Subject: plug memleak in error path based on a diff by lux (lx [at] shellcodes [dot] org), thanks! Diff via, tweak and ok tb@ --- usr.bin/mg/tags.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/mg') 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) -- cgit v1.2.3