summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-queue.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-23 05:48:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-23 05:48:43 +0000
commitf35c45cbdece0d03dbe324f1867029a10800d311 (patch)
treea2bc7e6ddfc01594d37213bc595ac76ecf6f5b2f /usr.bin/tmux/cmd-queue.c
parent2730257fbaba7370d1bdc85e3dbe62e7693fcace (diff)
Fix a couple of memory leaks, one when creating a new pane and one when
adding formats onto the queue item.
Diffstat (limited to 'usr.bin/tmux/cmd-queue.c')
-rw-r--r--usr.bin/tmux/cmd-queue.c10
1 files changed, 7 insertions, 3 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. */