aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-12-27 18:08:30 +0100
committerAndreas Schneider <asn@cynapses.org>2010-12-27 18:08:30 +0100
commita0e98f585a36e0032545107dbd90c6adab40e09b (patch)
treef6f625791cf09826d26c16a8f26811fb89fe3d7e /src
parent7c728acd12947ecb3d910b5ca79f4d628b66e6c2 (diff)
downloadlibssh-a0e98f585a36e0032545107dbd90c6adab40e09b.tar.gz
libssh-a0e98f585a36e0032545107dbd90c6adab40e09b.tar.xz
libssh-a0e98f585a36e0032545107dbd90c6adab40e09b.zip
misc: Fixed a possible memory leak.
Diffstat (limited to 'src')
-rw-r--r--src/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/misc.c b/src/misc.c
index 85ce117..9235770 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -576,13 +576,14 @@ char *ssh_path_expand_tilde(const char *d) {
r = malloc(ld + lh + 1);
if (r == NULL) {
+ SAFE_FREE(h);
return NULL;
}
if (lh > 0) {
memcpy(r, h, lh);
- SAFE_FREE(h);
}
+ SAFE_FREE(h);
memcpy(r + lh, p, ld + 1);
return r;