From 68d59a16cec91d2c2747c8c2862560e89f8f2d31 Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Mon, 14 Oct 2019 08:38:07 +0000
Subject: [PATCH] Memory leaks, from Igor Wong in GitHub issue 1934.

---
 cmd-parse.y | 1 +
 options.c   | 1 +
 tmux.c      | 1 +
 3 files changed, 3 insertions(+)

diff --git a/cmd-parse.y b/cmd-parse.y
index 0cd7c6bf6..2c924010c 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -696,6 +696,7 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds,
 			pr.status = CMD_PARSE_ERROR;
 			pr.error = cmd_parse_get_error(pi->file, line, cause);
 			free(cause);
+			cmd_list_free(cmdlist);
 			goto out;
 		}
 		cmd_list_append(cmdlist, add);
diff --git a/options.c b/options.c
index 1be9f8cd7..f683c566e 100644
--- a/options.c
+++ b/options.c
@@ -296,6 +296,7 @@ options_remove(struct options_entry *o)
 	else
 		options_value_free(o, &o->value);
 	RB_REMOVE(options_tree, &oo->tree, o);
+	free((void *)o->name);
 	free(o);
 }
 
diff --git a/tmux.c b/tmux.c
index c3fe3ee6f..fe2647f56 100644
--- a/tmux.c
+++ b/tmux.c
@@ -130,6 +130,7 @@ make_label(const char *label, char **cause)
 		free(base);
 		goto fail;
 	}
+	free(base);
 
 	if (mkdir(resolved, S_IRWXU) != 0 && errno != EEXIST)
 		goto fail;