Skip to content

switch-on-port-available: Fix crash when moving away from unavailable profile

We previously introduced logic to switch to a different profile if the active profile of a card became unavailable, on the following commit:

commit 30a551bb Author: João Paulo Rechi Vita jprvita@endlessm.com Date: Mon Dec 10 16:16:46 2018 -0800

switch-on-port-available: Check if we need to change the active profile

The original revision of that patch would check for card->active_profile before derefencing it, but it was dropped during review on the belief that cards always have an active profile at all times. Unfortunatelly this is not true during the creation of ALSA cards, where the following call sequence leads to PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED being fired when there is no active profile set on the card, leading to a NULL pointer derefence.

pa__init -> init_jacks -> report_jack_state

This commit fixes the problem by checking card->active_profile before dereferencing it.

Merge request reports