mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
misc: Fixed a memory leak.
This commit is contained in:
@@ -532,7 +532,7 @@ int ssh_mkdir(const char *pathname, mode_t mode) {
|
|||||||
* @return The expanded directory, NULL on error.
|
* @return The expanded directory, NULL on error.
|
||||||
*/
|
*/
|
||||||
char *ssh_path_expand_tilde(const char *d) {
|
char *ssh_path_expand_tilde(const char *d) {
|
||||||
char *h, *r;
|
char *h = NULL, *r;
|
||||||
const char *p;
|
const char *p;
|
||||||
size_t ld;
|
size_t ld;
|
||||||
size_t lh = 0;
|
size_t lh = 0;
|
||||||
@@ -581,6 +581,7 @@ char *ssh_path_expand_tilde(const char *d) {
|
|||||||
|
|
||||||
if (lh > 0) {
|
if (lh > 0) {
|
||||||
memcpy(r, h, lh);
|
memcpy(r, h, lh);
|
||||||
|
SAFE_FREE(h);
|
||||||
}
|
}
|
||||||
memcpy(r + lh, p, ld + 1);
|
memcpy(r + lh, p, ld + 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user