mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-23 11:32:25 +03:00
misc: Fixed a possible memory leak.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user