mirror of
https://github.com/tmate-io/tmate.git
synced 2025-04-15 23:18:23 +02:00
Fix two memory leaks when assigning shell variables in configuration
file/command prompt. From Tiago Cunha.
This commit is contained in:
parent
f8ea82d7dc
commit
27e9f77a49
@ -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>
|
* 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);
|
buf = xrealloc(buf, 1, len + strlen(t) + 1);
|
||||||
strlcpy(buf + len, t, strlen(t) + 1);
|
strlcpy(buf + len, t, strlen(t) + 1);
|
||||||
len += strlen(t);
|
len += strlen(t);
|
||||||
|
xfree(t);
|
||||||
|
|
||||||
have_arg = 1;
|
have_arg = 1;
|
||||||
break;
|
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);
|
buf = xrealloc(buf, 1, len + strlen(t) + 1);
|
||||||
strlcpy(buf + len, t, strlen(t) + 1);
|
strlcpy(buf + len, t, strlen(t) + 1);
|
||||||
len += strlen(t);
|
len += strlen(t);
|
||||||
|
xfree(t);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user