From: op Date: Wed, 29 Mar 2023 19:09:04 +0000 (+0000) Subject: plug leak of tagpos in poptag() if loadbuffer() fails X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0f829441deeade2a8d5588390f4690dc4d020190;p=openbsd plug leak of tagpos in poptag() if loadbuffer() fails --- diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c index 6cb0cf6db6a..ed12493a731 100644 --- a/usr.bin/mg/tags.c +++ b/usr.bin/mg/tags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tags.c,v 1.26 2023/03/29 10:42:34 op Exp $ */ +/* $OpenBSD: tags.c,v 1.27 2023/03/29 19:09:04 op Exp $ */ /* * This file is in the public domain. @@ -229,8 +229,11 @@ poptag(int f, int n) } s = SLIST_FIRST(&shead); SLIST_REMOVE_HEAD(&shead, entry); - if (loadbuffer(s->bname) == FALSE) + if (loadbuffer(s->bname) == FALSE) { + free(s->bname); + free(s); return (FALSE); + } curwp->w_dotline = s->dotline; curwp->w_doto = s->doto;