Free any temporary environment memory at SDL_Quit()
Fixes https://github.com/libsdl-org/SDL/issues/9860
This commit is contained in:
parent
4022682c28
commit
156ca356b5
2 changed files with 16 additions and 0 deletions
|
@ -58,6 +58,7 @@
|
||||||
extern int SDL_HelperWindowCreate(void);
|
extern int SDL_HelperWindowCreate(void);
|
||||||
extern int SDL_HelperWindowDestroy(void);
|
extern int SDL_HelperWindowDestroy(void);
|
||||||
#endif
|
#endif
|
||||||
|
extern void SDL_FreeEnvironmentMemory(void);
|
||||||
|
|
||||||
#ifdef SDL_BUILD_MAJOR_VERSION
|
#ifdef SDL_BUILD_MAJOR_VERSION
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
|
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
|
||||||
|
@ -557,6 +558,8 @@ void SDL_Quit(void)
|
||||||
|
|
||||||
SDL_CleanupTLS();
|
SDL_CleanupTLS();
|
||||||
|
|
||||||
|
SDL_FreeEnvironmentMemory();
|
||||||
|
|
||||||
SDL_bInMainQuit = SDL_FALSE;
|
SDL_bInMainQuit = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,19 @@
|
||||||
/* Note this isn't thread-safe! */
|
/* Note this isn't thread-safe! */
|
||||||
static char *SDL_envmem = NULL; /* Ugh, memory leak */
|
static char *SDL_envmem = NULL; /* Ugh, memory leak */
|
||||||
static size_t SDL_envmemlen = 0;
|
static size_t SDL_envmemlen = 0;
|
||||||
|
|
||||||
|
void SDL_FreeEnvironmentMemory(void)
|
||||||
|
{
|
||||||
|
if (SDL_envmem) {
|
||||||
|
SDL_free(SDL_envmem);
|
||||||
|
SDL_envmem = NULL;
|
||||||
|
SDL_envmemlen = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void SDL_FreeEnvironmentMemory(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Put a variable into the environment */
|
/* Put a variable into the environment */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue