snd_async_del_handler() has two switch statements that handle
PCM and CTL handler types, but not TIMER. When a TIMER type
handler is deleted, both switches fall through to default and
trigger assert(0), crashing any program that uses
snd_async_add_timer_handler().
Add the missing SND_ASYNC_HANDLER_TIMER cases to both switches,
and include timer_local.h to access struct _snd_timer.
Closes: https://github.com/alsa-project/alsa-lib/pull/525
Signed-off-by: Jin Li <jinli@lanxincomputing.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
#include "pcm/pcm_local.h"
#include "control/control_local.h"
+#include "timer/timer_local.h"
#include <signal.h>
static struct sigaction previous_action;
case SND_ASYNC_HANDLER_CTL:
alist = &handler->u.ctl->async_handlers;
break;
+#ifdef BUILD_PCM
+ case SND_ASYNC_HANDLER_TIMER:
+ alist = &handler->u.timer->async_handlers;
+ break;
+#endif
default:
assert(0);
}
case SND_ASYNC_HANDLER_CTL:
err2 = snd_ctl_async(handler->u.ctl, -1, 1);
break;
+#ifdef BUILD_PCM
+ case SND_ASYNC_HANDLER_TIMER:
+ err2 = snd_timer_async(handler->u.timer, -1, 1);
+ break;
+#endif
default:
assert(0);
}