aboutsummaryrefslogtreecommitdiff
path: root/src
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:26:07 +0200
commitc1604eff081514df3b6abb8c50c3acbab71d77ac (patch)
tree16dd8ca2701ffcc24dc76b0aabe51f504e1069bc /src
parent77b52a5e69d3f9219a3351d9bcd22f3463bca52d (diff)
downloadlibssh-c1604eff081514df3b6abb8c50c3acbab71d77ac.tar.gz
libssh-c1604eff081514df3b6abb8c50c3acbab71d77ac.tar.xz
libssh-c1604eff081514df3b6abb8c50c3acbab71d77ac.zip
misc: Fixed a 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 bd903b02..ee78d8b0 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -532,7 +532,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;
@@ -581,6 +581,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);