mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 22:58:51 +00:00
Ensure get_server_path retval is freeable
This commit is contained in:
parent
498ad23e98
commit
697283ad0e
1 changed files with 2 additions and 2 deletions
|
@ -61,7 +61,7 @@ get_server_path(void) {
|
||||||
LOGE("Could not get executable path, "
|
LOGE("Could not get executable path, "
|
||||||
"using " SERVER_FILENAME " from current directory");
|
"using " SERVER_FILENAME " from current directory");
|
||||||
// not found, use current directory
|
// not found, use current directory
|
||||||
return SERVER_FILENAME;
|
return SDL_strdup(SERVER_FILENAME);
|
||||||
}
|
}
|
||||||
char *dir = dirname(executable_path);
|
char *dir = dirname(executable_path);
|
||||||
size_t dirlen = strlen(dir);
|
size_t dirlen = strlen(dir);
|
||||||
|
@ -73,7 +73,7 @@ get_server_path(void) {
|
||||||
LOGE("Could not alloc server path string, "
|
LOGE("Could not alloc server path string, "
|
||||||
"using " SERVER_FILENAME " from current directory");
|
"using " SERVER_FILENAME " from current directory");
|
||||||
SDL_free(executable_path);
|
SDL_free(executable_path);
|
||||||
return SERVER_FILENAME;
|
return SDL_strdup(SERVER_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(server_path, dir, dirlen);
|
memcpy(server_path, dir, dirlen);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue