mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 14:56:00 +00:00
Ensure that all functions that follow the SDL_GetStringRule return temporary memory
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user