mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-27 00:51:34 +00:00
DOS & Tray: Don't do NULL-checks before SDL_free()
This commit is contained in:
committed by
Sam Lantinga
parent
3dbd3e43e2
commit
70159c34f6
@@ -485,12 +485,8 @@ static void DOSSOUNDBLASTER_CloseDevice(SDL_AudioDevice *device)
|
||||
}
|
||||
|
||||
// Free ring buffer resources.
|
||||
if (hidden->ring_buffer) {
|
||||
SDL_free(hidden->ring_buffer);
|
||||
}
|
||||
if (hidden->staging_buffer) {
|
||||
SDL_free(hidden->staging_buffer);
|
||||
}
|
||||
SDL_free(hidden->ring_buffer);
|
||||
SDL_free(hidden->staging_buffer);
|
||||
|
||||
// Clear ISR-visible statics.
|
||||
isr_ring_buffer = NULL;
|
||||
|
||||
@@ -48,9 +48,7 @@ SDL_Mutex *SDL_CreateMutex(void)
|
||||
|
||||
void SDL_DestroyMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
if (mutex) {
|
||||
SDL_free(mutex);
|
||||
}
|
||||
SDL_free(mutex);
|
||||
}
|
||||
|
||||
void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS
|
||||
|
||||
@@ -44,9 +44,7 @@ SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
|
||||
void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
{
|
||||
if (sem) {
|
||||
SDL_free(sem);
|
||||
}
|
||||
SDL_free(sem);
|
||||
}
|
||||
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
|
||||
@@ -561,9 +561,7 @@ void DestroyMenu(SDL_TrayMenu *menu)
|
||||
SDL_ListClear(&menu_dbus->menu);
|
||||
}
|
||||
|
||||
if (menu_dbus->array_representation) {
|
||||
SDL_free(menu_dbus->array_representation);
|
||||
}
|
||||
SDL_free(menu_dbus->array_representation);
|
||||
|
||||
SDL_free(menu_dbus);
|
||||
SDL_free(menu);
|
||||
@@ -656,9 +654,7 @@ void SetTrayTooltip(SDL_Tray *tray, const char *text)
|
||||
driver = (SDL_TrayDriverDBus *)tray->driver->internal;
|
||||
tray_dbus = (SDL_TrayDBus *)tray->internal;
|
||||
|
||||
if (tray_dbus->tooltip) {
|
||||
SDL_free(tray_dbus->tooltip);
|
||||
}
|
||||
SDL_free(tray_dbus->tooltip);
|
||||
|
||||
if (text) {
|
||||
tray_dbus->tooltip = SDL_strdup(text);
|
||||
@@ -907,9 +903,7 @@ SDL_TrayEntry **GetTrayEntries(SDL_TrayMenu *menu, int *count)
|
||||
|
||||
menu_dbus = (SDL_TrayMenuDBus *)menu->internal;
|
||||
|
||||
if (menu_dbus->array_representation) {
|
||||
SDL_free(menu_dbus->array_representation);
|
||||
}
|
||||
SDL_free(menu_dbus->array_representation);
|
||||
|
||||
sz = SDL_ListCountEntries(&menu_dbus->menu);
|
||||
array_representation = SDL_calloc(sz + 1, sizeof(SDL_TrayEntry *));
|
||||
|
||||
Reference in New Issue
Block a user