aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:03:28 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:03:28 +0000
commit27e9f77a49fb26c61041f4e68b2430d36e3d523b (patch)
tree5ffb995aefa341ceb0e5064b14f1b1116444b3b8
parentf8ea82d7dc8c3f778e31e67cff23a80f9ae15a84 (diff)
downloadrtmux-27e9f77a49fb26c61041f4e68b2430d36e3d523b.tar.gz
rtmux-27e9f77a49fb26c61041f4e68b2430d36e3d523b.tar.bz2
rtmux-27e9f77a49fb26c61041f4e68b2430d36e3d523b.zip
Fix two memory leaks when assigning shell variables in configuration
file/command prompt. From Tiago Cunha.
-rw-r--r--cmd-string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 6291fac5..0994e3fd 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-string.c,v 1.17 2009-06-25 16:21:32 nicm Exp $ */
+/* $Id: cmd-string.c,v 1.18 2009-07-09 18:03:28 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;
}