audio: Fixed resource leak in unlikely failure case during device add.

main
Ryan C. Gordon 2023-12-09 15:41:45 -05:00
parent 63ae84e140
commit f3d8a2def5
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 2 additions and 0 deletions

View File

@ -551,6 +551,8 @@ static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, SDL_bool isc
if (SDL_InsertIntoHashTable(current_audio.device_hash, (const void *) (uintptr_t) device->instance_id, device)) {
SDL_AtomicAdd(device_count, 1);
} else {
SDL_DestroyCondition(device->close_cond);
SDL_DestroyMutex(device->lock);
SDL_free(device->name);
SDL_free(device);
device = NULL;