summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-30 15:31:54 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-30 15:31:54 +0000
commitc91361ef06f6b94996a78b4c20345c76384b2440 (patch)
treeee3859d87b88c87f279548d7a016ef98fe09c9fc
parente848713151f76c41b5b12246b4ed29bee3eb3b5e (diff)
fix a few invalid calls to avahi_s_entry_group_xxx()
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1285 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r--avahi-daemon/static-hosts.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c
index 17b268b..9941a51 100644
--- a/avahi-daemon/static-hosts.c
+++ b/avahi-daemon/static-hosts.c
@@ -98,7 +98,8 @@ static void static_host_free(StaticHost *s) {
AVAHI_LLIST_REMOVE(StaticHost, hosts, hosts, s);
- avahi_s_entry_group_free (s->group);
+ if (s->group)
+ avahi_s_entry_group_free (s->group);
avahi_free(s->host);
avahi_free(s->ip);
@@ -112,7 +113,10 @@ static void add_static_host_to_server(StaticHost *h)
int err;
if (!h->group)
- h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h);
+ if (!(h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h))) {
+ avahi_log_error("avahi_s_entry_group_new() failed: %s", avahi_strerror(err));
+ return;
+ }
if (!avahi_address_parse (h->ip, AVAHI_PROTO_UNSPEC, &a)) {
avahi_log_error("Static host name %s: avahi_address_parse failed", h->host);
@@ -129,7 +133,8 @@ static void add_static_host_to_server(StaticHost *h)
static void remove_static_host_from_server(StaticHost *h)
{
- avahi_s_entry_group_reset (h->group);
+ if (h->group)
+ avahi_s_entry_group_reset (h->group);
}
void static_hosts_add_to_server(void) {