mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 06:58:30 +00:00
Fixed memory leak when SDL_Init() was called multiple times
This commit is contained in:
@@ -450,17 +450,19 @@ char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
|
||||
void SDL_InitFilesystem(void)
|
||||
{
|
||||
CachedBasePath = NULL; // just in case.
|
||||
SDL_zeroa(CachedUserFolders);
|
||||
}
|
||||
|
||||
void SDL_QuitFilesystem(void)
|
||||
{
|
||||
if (CachedBasePath) {
|
||||
SDL_free(CachedBasePath);
|
||||
CachedBasePath = NULL;
|
||||
}
|
||||
for (int i = 0; i < SDL_arraysize(CachedUserFolders); i++) {
|
||||
if (CachedUserFolders[i]) {
|
||||
SDL_free(CachedUserFolders[i]);
|
||||
CachedUserFolders[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user