]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixes: 5600b901 ("async: snd_async_del_handler - move clear signal using sigaction...
authorJaroslav Kysela <perex@perex.cz>
Fri, 6 Sep 2024 07:58:47 +0000 (09:58 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 6 Sep 2024 07:58:47 +0000 (09:58 +0200)
A wrong list head is used to check if the given list with async handlers
is empty. Correct this.

Link: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/async.c

index a003e44170ef1d012dba9eae1b5c133aca85cf26..4117354a454bbc09aebca919ac6b15289994bae6 100644 (file)
@@ -153,9 +153,22 @@ int snd_async_del_handler(snd_async_handler_t *handler)
        int was_empty;
        assert(handler);
        if (handler->type != SND_ASYNC_HANDLER_GENERIC) {
-               if (!list_empty(&handler->hlist))
+               struct list_head *alist;
+               switch (handler->type) {
+#ifdef BUILD_PCM
+               case SND_ASYNC_HANDLER_PCM:
+                       alist = &handler->u.pcm->async_handlers;
+                       break;
+#endif
+               case SND_ASYNC_HANDLER_CTL:
+                       alist = &handler->u.ctl->async_handlers;
+                       break;
+               default:
+                       assert(0);
+               }
+               if (!list_empty(alist))
                        list_del(&handler->hlist);
-               if (!list_empty(&handler->hlist))
+               if (!list_empty(alist))
                        goto _glist;
                switch (handler->type) {
 #ifdef BUILD_PCM