From cf2c154df332b9ce97b222523b6e3206936f612e Mon Sep 17 00:00:00 2001 From: op Date: Wed, 22 Mar 2023 22:09:37 +0000 Subject: [PATCH] plug another leak in addctag; found + ok tb@ --- usr.bin/mg/tags.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c index cd87ee556e7..0e44c0f971e 100644 --- a/usr.bin/mg/tags.c +++ b/usr.bin/mg/tags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tags.c,v 1.22 2023/03/22 19:42:41 op Exp $ */ +/* $OpenBSD: tags.c,v 1.23 2023/03/22 22:09:37 op Exp $ */ /* * This file is in the public domain. @@ -388,7 +388,8 @@ addctag(char *s) if (*l == '\0') goto cleanup; t->pat = strip(l, strlen(l)); - RB_INSERT(tagtree, &tags, t); + if (RB_INSERT(tagtree, &tags, t) != NULL) + goto cleanup; return (TRUE); cleanup: free(t); -- 2.20.1