Fix potential assert in avahi backend

avahi_browser contains a reference to an AvahiClient, which may be
avahi_client.  If it does, then freeing avahi_browser references avahi_client,
resulting in an assert() in Avahi's linked list macro.

Fix this by freeing avahi_browser before avahi_client.
See https://bugs.launchpad.net/bugs/831867
merge-requests/1/head
Christopher James Halse Rogers 2017-05-13 13:07:01 +09:00 zatwierdzone przez Olaf Meeuwissen
rodzic e6711c377f
commit 77dcf26860
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -846,15 +846,15 @@ net_avahi_callback (AvahiClient *c, AvahiClientState state, void * userdata)
if (error == AVAHI_ERR_DISCONNECTED)
{
/* Server disappeared - try to reconnect */
avahi_client_free (avahi_client);
avahi_client = NULL;
if (avahi_browser)
{
avahi_service_browser_free (avahi_browser);
avahi_browser = NULL;
}
avahi_client_free (avahi_client);
avahi_client = NULL;
avahi_client = avahi_client_new (avahi_threaded_poll_get (avahi_thread), AVAHI_CLIENT_NO_FAIL, net_avahi_callback, NULL, &error);
if (avahi_client == NULL)
{