]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/dbus-sync-service-resolver.c
fix avahi_netlink_new to allow multiple netlinks per process
[catta] / avahi-daemon / dbus-sync-service-resolver.c
index df17203856663f9ac353e533595711301e074a0a..ed7276afd4734ecbe56e0cb8f33b95dfff991752 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
 
@@ -42,8 +40,8 @@ void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i) {
     dbus_message_unref(i->message);
     AVAHI_LLIST_REMOVE(SyncServiceResolverInfo, sync_service_resolvers, i->client->sync_service_resolvers, i);
 
+    assert(i->client->n_objects >= 1);
     i->client->n_objects--;
-    assert(i->client->n_objects >= 0);
 
     avahi_free(i);
 }
@@ -92,12 +90,18 @@ void avahi_dbus_sync_service_resolver_callback(
         i_interface = (int32_t) interface;
         i_protocol = (int32_t) protocol;
         if (a)
-           i_aprotocol = (int32_t) a->proto;
-       else
-           i_aprotocol = AVAHI_PROTO_UNSPEC;
+            i_aprotocol = (int32_t) a->proto;
+        else
+            i_aprotocol = AVAHI_PROTO_UNSPEC;
         u_flags = (uint32_t) flags;
 
         reply = dbus_message_new_method_return(i->message);
+
+        if (!reply) {
+            avahi_log_error("Failed allocate message");
+            goto finish;
+        }
+
         dbus_message_append_args(
             reply,
             DBUS_TYPE_INT32, &i_interface,
@@ -126,5 +130,6 @@ void avahi_dbus_sync_service_resolver_callback(
         avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
     }
 
+finish:
     avahi_dbus_sync_service_resolver_free(i);
 }