zeroconf: avoid passing NULLs to Avahi *_free() routines

This should fix Debian bug #428551
(mpd crashes when restarting the dbus daemon)

git-svn-id: https://svn.musicpd.org/mpd/trunk@6844 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2007-09-02 02:18:09 +00:00
parent bbe8b0efd8
commit 203a5ed26d

View File

@ -309,10 +309,12 @@ static void avahiClientCallback(AvahiClient *c, AvahiClientState state, void *us
int reason = avahi_client_errno(c);
if( reason == AVAHI_ERR_DISCONNECTED ) {
LOG( "Avahi: Client Disconnected, will reconnect shortly\n");
avahi_entry_group_free( avahiGroup );
avahiGroup = NULL;
avahi_client_free( avahiClient );
avahiClient = NULL;
if (avahiGroup) {
avahi_entry_group_free(avahiGroup);
avahiGroup = NULL;
}
if (avahiClient)
avahi_client_free(avahiClient);
avahiClient = avahi_client_new( &avahiPoll, AVAHI_CLIENT_NO_FAIL,
avahiClientCallback, NULL, &reason );
if( !avahiClient ) {