From 56706f14279a9e2b48b3d04a39bcf96b12eec5a7 Mon Sep 17 00:00:00 2001 From: op Date: Wed, 22 Mar 2023 18:18:35 +0000 Subject: [PATCH] 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(-) 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) -- 2.20.1