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:
Sam Lantinga
2024-07-18 15:56:41 -07:00
parent ef884c8aa6
commit bb96320cc4
19 changed files with 66 additions and 71 deletions

View File

@@ -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);
}