1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2026-10-24 03:48:55 +03:00

misc: use strdup in ssh_get_user_home_dir_internal

Signed-off-by: Om Upadhyay <omupadhyay3personal@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/897>
This commit is contained in:
Om Upadhyay
2026-10-16 00:36:26 +05:30
committed by Jakub Jelen
parent de42e7e7d8
commit 9de02f3d01

View File

@@ -112,16 +112,9 @@
static char *ssh_get_user_home_dir_internal(void)
{
char tmp[PATH_MAX] = {0};
char *szPath = NULL;
if (SHGetSpecialFolderPathA(NULL, tmp, CSIDL_PROFILE, TRUE)) {
szPath = malloc(strlen(tmp) + 1);
if (szPath == NULL) {
return NULL;
}
strcpy(szPath, tmp);
return szPath;
return strdup(tmp);
}
return NULL;