From f12795330be2a3d6f12dd15680f3baf20f6f8f61 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Mon, 6 Jul 2020 12:39:42 +0300 Subject: [PATCH] alsa-ucm: Fix NULL pointer handling get_mixer_device() can return NULL when no mixer device is configured for the device, so mdev2 can be NULL. --- src/modules/alsa/alsa-ucm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c index 295286555..c32d3c121 100644 --- a/src/modules/alsa/alsa-ucm.c +++ b/src/modules/alsa/alsa-ucm.c @@ -935,11 +935,12 @@ static void probe_volumes(pa_hashmap *hash, bool is_sink, snd_pcm_t *pcm_handle, mdev = NULL; PA_DYNARRAY_FOREACH(dev, data->devices, idx) { mdev2 = get_mixer_device(dev, is_sink); - if (mdev && !pa_streq(mdev, mdev2)) { + if (mdev && mdev2 && !pa_streq(mdev, mdev2)) { pa_log_error("Two mixer device names found ('%s', '%s'), using s/w volume", mdev, mdev2); goto fail; } - mdev = mdev2; + if (mdev2) + mdev = mdev2; } if (mdev == NULL || !(mixer_handle = pa_alsa_open_mixer_by_name(mixers, mdev, true))) {