diff options
author | nicm <nicm> | 2020-04-23 05:48:42 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-23 05:48:42 +0000 |
commit | 906dfe9f5c217bb026929120b346722e5cb32106 (patch) | |
tree | b426bc7d4ce1a4f7f5635083af24ac71fca12fa8 | |
parent | e46cf86d307546e2f31e54e1af59d8e275a60269 (diff) | |
download | rtmux-906dfe9f5c217bb026929120b346722e5cb32106.tar.gz rtmux-906dfe9f5c217bb026929120b346722e5cb32106.tar.bz2 rtmux-906dfe9f5c217bb026929120b346722e5cb32106.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-- | cmd-queue.c | 8 | ||||
-rw-r--r-- | spawn.c | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/cmd-queue.c b/cmd-queue.c index 5df30940..59f86c64 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -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. */ @@ -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) { |