Skip to content

Commit 26b2f45

Browse files
committed
Fix memory leak
1 parent 8af443e commit 26b2f45

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

platforms/shared/desktop/config.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void config_init(void)
161161
const char* root_path = NULL;
162162

163163
if (check_portable())
164-
root_path = SDL_GetBasePath();
164+
root_path = SDL_strdup(SDL_GetBasePath());
165165
else
166166
root_path = SDL_GetPrefPath("Geardome", GG_TITLE);
167167

@@ -780,16 +780,15 @@ static bool check_portable(void)
780780
{
781781
const char* base_path;
782782
char portable_file_path[260];
783-
783+
784784
base_path = SDL_GetBasePath();
785785
if (base_path == NULL)
786786
return false;
787-
787+
788788
snprintf(portable_file_path, sizeof(portable_file_path), "%sportable.ini", base_path);
789-
SDL_free((void*)base_path);
790789

791790
FILE* file = fopen_utf8(portable_file_path, "r");
792-
791+
793792
if (IsValidPointer(file))
794793
{
795794
fclose(file);

0 commit comments

Comments
 (0)