From: op Date: Wed, 22 Mar 2023 22:09:37 +0000 (+0000) Subject: plug another leak in addctag; found + ok tb@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cf2c154df332b9ce97b222523b6e3206936f612e;p=openbsd plug another leak in addctag; found + ok tb@ --- 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);