diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2018-05-24 20:31:51 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2018-05-30 19:56:29 +0300 |
commit | 9e5be0899f60208046f1c5e2d32a2dd207d8fa00 (patch) | |
tree | 92a57ae0d120bbef693fb0ce9d2660fef28f6cdd | |
parent | 1e68e9aa1044bdb17b21514b4d711e54421d396d (diff) | |
download | pulseaudio-9e5be0899f60208046f1c5e2d32a2dd207d8fa00.tar.gz |
alsa-card: fix null dereference
jack->melem can be null if the jack disappears between probing the card
and the init_jacks() call. I don't know if jacks actually ever disappear
like that (seems unlikely), but this check is in any case needed as long
as init_jacks() has proper handling for the jack disappearing case
(rather than just an assert).
There was a crash report[1] that indicated that card_suspend_changed()
called report_jack_state() with a null melem. I don't know if that was
because the jack actually disappeared, or is there some other bug too.
[1] https://bugs.freedesktop.org/show_bug.cgi?id=104385
-rw-r--r-- | src/modules/alsa/module-alsa-card.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index b193d40cc..1f78f18d1 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -640,7 +640,8 @@ static pa_hook_result_t card_suspend_changed(pa_core *c, pa_card *card, struct u if (card->suspend_cause == 0) { /* We were unsuspended, update jack state in case it changed while we were suspended */ PA_HASHMAP_FOREACH(jack, u->jacks, state) { - report_jack_state(jack->melem, 0); + if (jack->melem) + report_jack_state(jack->melem, 0); } } |