summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authornicm <nicm>2009-07-09 18:03:28 (GMT)
committer nicm <nicm>2009-07-09 18:03:28 (GMT)
commit0696f9e8000354a66bc411d5bdd7f44a5820715d (patch) (side-by-side diff)
tree61a0087021bc33dfc89063bf1725b8228843f42d /cmd-string.c
parent92e2373d0782e5480c30004519b0090e70388e4e (diff)
downloadtmux-old-0696f9e8000354a66bc411d5bdd7f44a5820715d.zip
tmux-old-0696f9e8000354a66bc411d5bdd7f44a5820715d.tar.gz
tmux-old-0696f9e8000354a66bc411d5bdd7f44a5820715d.tar.bz2
Fix two memory leaks when assigning shell variables in configuration
file/command prompt. From Tiago Cunha.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 897c7b1..8da781d 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -114,6 +114,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;
@@ -219,6 +220,7 @@ cmd_string_string(const char *s, size_t *p, char endch, int esc)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+ xfree(t);
continue;
}