zeroconf-publish: Fix crash when avahi_client_new() fails

When the module is loaded and avahi_client_new() fails because the client cannot
connect, a shutdown of the module is scheduled. In parallel, the client_callback
is called with AVAHI_ERR_DISCONNECTED and another connection attempt is made
which also fails and triggers a second unload of the module. This crashes PA,
because there is already an unload in progress.
This patch fixes the problem by checking if an unload is already scheduled.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/710>
This commit is contained in:
Georg Chini 2022-05-26 12:57:45 +02:00 committed by PulseAudio Marge Bot
parent 5bba8ee621
commit 65889fbdee

View file

@ -645,7 +645,7 @@ static int avahi_process_msg(pa_msgobject *o, int code, void *data, int64_t offs
pa_assert(u);
if (u->shutting_down)
if (u->shutting_down || u->module->unload_requested)
return 0;
switch (code) {