diff options
author | Omar Polo <op@cvs.openbsd.org> | 2023-03-29 19:09:05 +0000 |
---|---|---|
committer | Omar Polo <op@cvs.openbsd.org> | 2023-03-29 19:09:05 +0000 |
commit | 8fba2c72f5c39d2bd098b827d23464d66356e8e3 (patch) | |
tree | 837ce4c7f86d20a11660dc94b05ba7a21e618ece /usr.bin/mg | |
parent | a7f2432ecc570277780e44afd8944d8e2fe1286b (diff) |
plug leak of tagpos in poptag() if loadbuffer() fails
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/tags.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |