Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the return value from get_server_path is freeable #2276

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ get_server_path(void) {
LOGE("Could not get executable path, "
"using " SERVER_FILENAME " from current directory");
// not found, use current directory
return SERVER_FILENAME;
return SDL_strdup(SERVER_FILENAME);
}
char *dir = dirname(executable_path);
size_t dirlen = strlen(dir);
Expand All @@ -73,7 +73,7 @@ get_server_path(void) {
LOGE("Could not alloc server path string, "
"using " SERVER_FILENAME " from current directory");
SDL_free(executable_path);
return SERVER_FILENAME;
return SDL_strdup(SERVER_FILENAME);
}

memcpy(server_path, dir, dirlen);
Expand Down