From b9bae7fdcf0c920ee7bb79af1ac70475be754777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 6 May 2026 21:49:52 +0200 Subject: [PATCH] spa: alsa: pcm: spa_alsa_clear(): clear pointers Use `spa_clear_ptr()` to ensure that all freed pointers are cleared. --- spa/plugins/alsa/alsa-pcm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 458c40ec9..ff301857a 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1100,8 +1100,8 @@ int spa_alsa_clear(struct state *state) state->card = NULL; state->card_index = SPA_ID_INVALID; - free(state->tag[0]); - free(state->tag[1]); + spa_clear_ptr(state->tag[0], free); + spa_clear_ptr(state->tag[1], free); if (state->ctl) { for (int i = 0; i < state->ctl_n_fds; i++) { @@ -1127,9 +1127,8 @@ int spa_alsa_clear(struct state *state) if ((err = snd_output_close(state->output)) < 0) spa_log_warn(state->log, "output close failed: %s", snd_strerror(err)); } - if (state->log_file) - fclose(state->log_file); + spa_clear_ptr(state->log_file, fclose); spa_clear_ptr(state->alsa_chmap, free); return err;