]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/dbus-async-address-resolver.c
daemon: add some minimal OOM checking against D-Bus
[catta] / avahi-daemon / dbus-async-address-resolver.c
index 195984176e28b1121ed76323ccfe10807c8868ee..5be08c29ae30ed60b65c119b8d148f2371c21f16 100644 (file)
@@ -44,8 +44,8 @@ void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
 
     AVAHI_LLIST_REMOVE(AsyncAddressResolverInfo, async_address_resolvers, i->client->async_address_resolvers, i);
 
+    assert(i->client->n_objects >= 1);
     i->client->n_objects--;
-    assert(i->client->n_objects >= 0);
 
     avahi_free(i);
 }
@@ -59,6 +59,11 @@ void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiI
 
     reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
 
+    if (!reply) {
+        avahi_log_error("Failed allocate message");
+        return;
+    }
+
     if (event == AVAHI_RESOLVER_FOUND) {
         char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
         int32_t i_interface, i_protocol, i_aprotocol;