spa: alsa: pcm: spa_alsa_clear(): clear pointers

Use `spa_clear_ptr()` to ensure that all freed pointers are cleared.
This commit is contained in:
Barnabás Pőcze 2026-05-06 21:49:52 +02:00 committed by Wim Taymans
parent c8462edf4b
commit b9bae7fdcf

View file

@ -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;