From: Tanu Kaskinen Date: Mon, 4 Aug 2014 12:33:01 +0000 (+0300) Subject: alsa: Handle unlinking of uninitialized streams gracefully X-Git-Tag: accepted/tizen/common/20140829.173154~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F26441%2F1;p=platform%2Fupstream%2Fpulseaudio.git alsa: Handle unlinking of uninitialized streams gracefully There should be no assumptions about what has been initialized when the unlink hook is fired. Change-Id: I7502f0e7a3d244413dd806bc8657014999c9b9b3 --- diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index 1e63230..7c408ee 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -579,7 +579,11 @@ static pa_hook_result_t sink_input_unlink_hook_callback(pa_core *c, pa_sink_inpu const char *role; pa_sink *sink = sink_input->sink; - pa_assert(sink); + if (!sink) + return PA_HOOK_OK; + + if (!sink_input->proplist) + return PA_HOOK_OK; role = pa_proplist_gets(sink_input->proplist, PA_PROP_MEDIA_ROLE); @@ -594,7 +598,11 @@ static pa_hook_result_t source_output_unlink_hook_callback(pa_core *c, pa_source const char *role; pa_source *source = source_output->source; - pa_assert(source); + if (!source) + return PA_HOOK_OK; + + if (!source_output->proplist) + return PA_HOOK_OK; role = pa_proplist_gets(source_output->proplist, PA_PROP_MEDIA_ROLE);