summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authornicm <nicm>2009-02-16 19:29:17 (GMT)
committer nicm <nicm>2009-02-16 19:29:17 (GMT)
commitc9bc7c6ed0cfa3ee3947adaceb18ddbd42801792 (patch) (side-by-side diff)
treecdb881a9b99b4fe36118f147efe38885872bf5d6 /cmd-string.c
parentcaff1286f880f7c3469d29e14d53bed2719ed140 (diff)
downloadtmux-old-c9bc7c6ed0cfa3ee3947adaceb18ddbd42801792.zip
tmux-old-c9bc7c6ed0cfa3ee3947adaceb18ddbd42801792.tar.gz
tmux-old-c9bc7c6ed0cfa3ee3947adaceb18ddbd42801792.tar.bz2
Don't leak string arguments and options.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 940d698..b5ed4ca 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -94,6 +94,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+ xfree(t);
have_arg = 1;
break;
@@ -103,6 +104,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+ xfree(t);
have_arg = 1;
break;
@@ -145,6 +147,10 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
if (*cmdlist == NULL)
goto out;
+ do
+ xfree(argv[argc - 1]);
+ while (--argc > 0);
+
rval = 0;
goto out;
default: