summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-08 16:04:56 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-08 16:04:56 +0000
commitf63761eabcab7c8e1c623be366974441c5877651 (patch)
treefc41ce84303e509cd3bb597a50a74b6f94d4e6e9 /cmd-string.c
parent8c497ecac0ba0d20b0129e195e1bebf443772faf (diff)
Fix two memory leaks when assigning shell variables in configuration
file/command prompt. From Tiago Cunha.
Diffstat (limited to 'cmd-string.c')
-rw-r--r--cmd-string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd-string.c b/cmd-string.c
index a5c5dd12..c6ef61b0 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;
}