mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
misc: Fixed a possible memory leak.
(cherry picked from commit a0e98f585a)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user