Skip to content

Commit

Permalink
Ensure get_server_path() retval is freeable
Browse files Browse the repository at this point in the history
PR #2276 <#2276>

Signed-off-by: Romain Vimont <[email protected]>
  • Loading branch information
frankleonrose authored and rom1v committed Apr 22, 2021
1 parent b9c3f65 commit aaf7875
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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 strdup(SERVER_FILENAME);
}
char *dir = dirname(executable_path);
size_t dirlen = strlen(dir);
Expand All @@ -70,7 +70,7 @@ get_server_path(void) {
LOGE("Could not alloc server path string, "
"using " SERVER_FILENAME " from current directory");
free(executable_path);
return SERVER_FILENAME;
return strdup(SERVER_FILENAME);
}

memcpy(server_path, dir, dirlen);
Expand Down

0 comments on commit aaf7875

Please sign in to comment.