diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-01-26 22:16:35 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-01-26 22:16:35 +0000 |
commit | 1d30ef6257897a8dc78ebe831c8e10834054f348 (patch) | |
tree | 84581fdf45c6af36bf4574b2935cf79da73727c9 | |
parent | 27bfd14c4a6468f185689da0e027e88d3240387f (diff) | |
download | mpd-1d30ef6257897a8dc78ebe831c8e10834054f348.tar.gz mpd-1d30ef6257897a8dc78ebe831c8e10834054f348.tar.xz mpd-1d30ef6257897a8dc78ebe831c8e10834054f348.zip |
zeroconf: avoid passing NULLs to Avahi *_free() routines
This should fix Debian bug #428551
(mpd crashes when restarting the dbus daemon)
r6844 in trunk
git-svn-id: https://svn.musicpd.org/mpd/branches/branch-0.13.0-fixes@7158 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/zeroconf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/zeroconf.c b/src/zeroconf.c index eeec794cd..0b0163218 100644 --- a/src/zeroconf.c +++ b/src/zeroconf.c @@ -297,10 +297,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 ) { |