summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@cvs.openbsd.org>2023-03-22 22:09:38 +0000
committerOmar Polo <op@cvs.openbsd.org>2023-03-22 22:09:38 +0000
commited0086bc8e7dd270b6fd049ddc6c38eb9ad5716c (patch)
tree4cfab205fd81e272891fe2c07bd2b61dd6d59d2f
parent53ae0a7b2975ae432133fa361e12c7adbd3b2896 (diff)
plug another leak in addctag; found + ok tb@
-rw-r--r--usr.bin/mg/tags.c5
1 files 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);