mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-29 10:01:35 +00:00
Don't do NULL-checks before SDL_free()
Replaces the pattern
if (ptr) {
SDL_free(ptr);
}
with
SDL_free(ptr);
This commit is contained in:
committed by
Sam Lantinga
parent
2f810e0a5f
commit
aaee09d6ed
@@ -223,9 +223,7 @@ static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device)
|
||||
audiodata->playsem = NULL;
|
||||
}
|
||||
|
||||
if (audiodata->mixbuff) {
|
||||
SDL_free(audiodata->mixbuff);
|
||||
}
|
||||
SDL_free(audiodata->mixbuff);
|
||||
}
|
||||
|
||||
// !!! FIXME: make this non-blocking!
|
||||
@@ -419,9 +417,7 @@ static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device)
|
||||
audiodata->playsem = NULL;
|
||||
}
|
||||
|
||||
if (audiodata->mixbuff) {
|
||||
SDL_free(audiodata->mixbuff);
|
||||
}
|
||||
SDL_free(audiodata->mixbuff);
|
||||
}
|
||||
|
||||
static bool OPENSLES_CreatePCMPlayer(SDL_AudioDevice *device)
|
||||
|
||||
@@ -635,16 +635,12 @@ static int metadata_property(void *object, Uint32 subject, const char *key, cons
|
||||
|
||||
if (subject == PW_ID_CORE && key && value) {
|
||||
if (!SDL_strcmp(key, "default.audio.sink")) {
|
||||
if (pipewire_default_sink_id) {
|
||||
SDL_free(pipewire_default_sink_id);
|
||||
}
|
||||
SDL_free(pipewire_default_sink_id);
|
||||
pipewire_default_sink_id = get_name_from_json(value);
|
||||
node->persist = true;
|
||||
change_default_device(pipewire_default_sink_id);
|
||||
} else if (!SDL_strcmp(key, "default.audio.source")) {
|
||||
if (pipewire_default_source_id) {
|
||||
SDL_free(pipewire_default_source_id);
|
||||
}
|
||||
SDL_free(pipewire_default_source_id);
|
||||
pipewire_default_source_id = get_name_from_json(value);
|
||||
node->persist = true;
|
||||
change_default_device(pipewire_default_source_id);
|
||||
|
||||
Reference in New Issue
Block a user