aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-09-02 02:18:09 +0000
committerEric Wong <normalperson@yhbt.net>2007-09-02 02:18:09 +0000
commit203a5ed26d8d955dbe0490b35274571269751d8c (patch)
tree331be09be70d5cf23d2a314b475bb9ad90e31486
parentbbe8b0efd884411247fca6b7366faf178bd0e0f4 (diff)
downloadmpd-203a5ed26d8d955dbe0490b35274571269751d8c.tar.gz
mpd-203a5ed26d8d955dbe0490b35274571269751d8c.tar.xz
mpd-203a5ed26d8d955dbe0490b35274571269751d8c.zip
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
-rw-r--r--src/zeroconf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/zeroconf.c b/src/zeroconf.c
index 539f482c7..1836c64ca 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -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 ) {