summaryrefslogtreecommitdiffstats
path: root/libssh
diff options
context:
space:
mode:
Diffstat (limited to 'libssh')
-rw-r--r--libssh/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index e544cb2f..7e842770 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -548,13 +548,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;