aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-09-07 17:26:07 +0200
committerAndreas Schneider <asn@cynapses.org>2010-09-07 17:33:29 +0200
commitb5f095d0b433728d312b16911bd54ebd76895407 (patch)
tree0fedc9f6e69a2e06913bf0f407e03b005dd8e740
parent62f7eaf1560b556664244083c14f59998a7c35b3 (diff)
downloadlibssh-b5f095d0b433728d312b16911bd54ebd76895407.tar.gz
libssh-b5f095d0b433728d312b16911bd54ebd76895407.tar.xz
libssh-b5f095d0b433728d312b16911bd54ebd76895407.zip
misc: Fixed a memory leak.
(cherry picked from commit c1604eff081514df3b6abb8c50c3acbab71d77ac)
-rw-r--r--libssh/misc.c3
1 files changed, 2 insertions, 1 deletions
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);