From ed0086bc8e7dd270b6fd049ddc6c38eb9ad5716c Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Wed, 22 Mar 2023 22:09:38 +0000 Subject: 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); -- cgit v1.2.3