From b5f095d0b433728d312b16911bd54ebd76895407 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 7 Sep 2010 17:26:07 +0200 Subject: misc: Fixed a memory leak. (cherry picked from commit c1604eff081514df3b6abb8c50c3acbab71d77ac) --- libssh/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libssh/misc.c') diff --git a/libssh/misc.c b/libssh/misc.c index 9c7c0e66..e544cb2f 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -504,7 +504,7 @@ int ssh_mkdir(const char *pathname, mode_t mode) { * @return The expanded directory, NULL on error. */ char *ssh_path_expand_tilde(const char *d) { - char *h, *r; + char *h = NULL, *r; const char *p; size_t ld; size_t lh = 0; @@ -553,6 +553,7 @@ char *ssh_path_expand_tilde(const char *d) { if (lh > 0) { memcpy(r, h, lh); + SAFE_FREE(h); } memcpy(r + lh, p, ld + 1); -- cgit