audio: Fixed resource leak in unlikely failure case during device add.
This commit is contained in:
@@ -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)) {
|
if (SDL_InsertIntoHashTable(current_audio.device_hash, (const void *) (uintptr_t) device->instance_id, device)) {
|
||||||
SDL_AtomicAdd(device_count, 1);
|
SDL_AtomicAdd(device_count, 1);
|
||||||
} else {
|
} else {
|
||||||
|
SDL_DestroyCondition(device->close_cond);
|
||||||
|
SDL_DestroyMutex(device->lock);
|
||||||
SDL_free(device->name);
|
SDL_free(device->name);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
device = NULL;
|
device = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user