summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-23 05:48:42 +0000
committernicm <nicm@openbsd.org>2020-04-23 05:48:42 +0000
commit928e56dc8f55005879bb6b5f5fece6d8de82f281 (patch)
tree336267febe463ed0a7b8f5b527af85a215a9e74c
parentRecent changes in usr/mdec require (substantial) growth of the ramdisk. (diff)
downloadwireguard-openbsd-928e56dc8f55005879bb6b5f5fece6d8de82f281.tar.xz
wireguard-openbsd-928e56dc8f55005879bb6b5f5fece6d8de82f281.zip
Fix a couple of memory leaks, one when creating a new pane and one when
adding formats onto the queue item.
-rw-r--r--usr.bin/tmux/cmd-queue.c10
-rw-r--r--usr.bin/tmux/spawn.c5
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c
index 3292ee5d07b..0c6944474c3 100644
--- a/usr.bin/tmux/cmd-queue.c
+++ b/usr.bin/tmux/cmd-queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-queue.c,v 1.90 2020/04/14 06:00:52 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.91 2020/04/23 05:48:42 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -243,8 +243,12 @@ cmdq_copy_state(struct cmdq_state *state)
void
cmdq_free_state(struct cmdq_state *state)
{
- if (--state->references == 0)
- free(state);
+ if (--state->references != 0)
+ return;
+
+ if (state->formats != NULL)
+ format_free(state->formats);
+ free(state);
}
/* Add a format to command queue. */
diff --git a/usr.bin/tmux/spawn.c b/usr.bin/tmux/spawn.c
index 7d10fbe099a..c19d7e37dea 100644
--- a/usr.bin/tmux/spawn.c
+++ b/usr.bin/tmux/spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spawn.c,v 1.21 2020/04/13 20:51:57 nicm Exp $ */
+/* $OpenBSD: spawn.c,v 1.22 2020/04/23 05:48:42 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -366,6 +366,7 @@ spawn_pane(struct spawn_context *sc, char **cause)
window_remove_pane(w, new_wp);
}
sigprocmask(SIG_SETMASK, &oldset, NULL);
+ environ_free(child);
return (NULL);
}
@@ -443,6 +444,8 @@ complete:
sigprocmask(SIG_SETMASK, &oldset, NULL);
window_pane_set_event(new_wp);
+ environ_free(child);
+
if (sc->flags & SPAWN_RESPAWN)
return (new_wp);
if ((~sc->flags & SPAWN_DETACHED) || w->active == NULL) {