Ensure that all functions that follow the SDL_GetStringRule return temporary memory

This commit is contained in:
Sam Lantinga committed 2024-07-19 12:22:03 -07:00
1 parent fd9fe1bb7b
commit 68322ac851
12 files changed
+15 -36

No files matched your search

+2 -4
View File
@@ -131,19 +131,17 @@ int SDL_GetNumAudioDrivers(void)
return num_drivers;
}
// this returns string literals, so there's no need to use SDL_FreeLater.
const char *SDL_GetAudioDriver(int index)
{
if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
return deduped_bootstrap[index]->name;
return SDL_CreateTemporaryString(deduped_bootstrap[index]->name);
}
return NULL;
}
// this returns string literals, so there's no need to use SDL_FreeLater.
const char *SDL_GetCurrentAudioDriver(void)
{
return current_audio.name;
return SDL_CreateTemporaryString(current_audio.name);
}
static int GetDefaultSampleFramesFromFreq(const int freq)