mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 15:08:31 +00:00
Make sure we always copy the data returned using SDL_GetStringRule
This prevents race conditions where calling an API from one thread returns the data and it's freed by updates on another thread
This commit is contained in:
@@ -383,8 +383,7 @@ const char * const *SDL_InternalGlobDirectory(const char *path, const char *patt
|
||||
SDL_free(folded);
|
||||
SDL_free(pathcpy);
|
||||
|
||||
SDL_FreeLater(retval);
|
||||
return (const char * const *) retval;
|
||||
return SDL_FreeLater(retval);
|
||||
}
|
||||
|
||||
static int GlobDirectoryGetPathInfo(const char *path, SDL_PathInfo *info, void *userdata)
|
||||
@@ -435,10 +434,7 @@ const char *SDL_GetUserFolder(SDL_Folder folder)
|
||||
const char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *path = SDL_SYS_GetPrefPath(org, app);
|
||||
if (path) {
|
||||
SDL_FreeLater(path);
|
||||
}
|
||||
return path;
|
||||
return SDL_FreeLater(path);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user