From: Ralf Habacker Date: Tue, 8 Mar 2022 07:48:31 +0000 (+0100) Subject: bus: Add assertions to silence compiler warnings X-Git-Tag: dbus-1.15.0~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da36b47af1b27606190e0f9ad27aaa23eb187304;p=thirdparty%2Fdbus.git bus: Add assertions to silence compiler warnings gcc 10.3 warns that link->data might be NULL, which would make new_owner->conn a null pointer dereference. However, we know that we only add valid, non-null BusOwner objects to the list, so that can't happen in reality. Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275 Reviewed-by: Simon McVittie --- diff --git a/bus/services.c b/bus/services.c index 6f642a438..a7dd181eb 100644 --- a/bus/services.c +++ b/bus/services.c @@ -1082,6 +1082,7 @@ bus_service_swap_owner (BusService *service, _dbus_assert (link != NULL); link = _dbus_list_get_next_link (&service->owners, link); _dbus_assert (link != NULL); + _dbus_assert (link->data != NULL); new_owner = (BusOwner *)link->data; new_owner_conn = new_owner->conn; @@ -1176,6 +1177,7 @@ bus_service_remove_owner (BusService *service, _dbus_assert (link != NULL); link = _dbus_list_get_next_link (&service->owners, link); _dbus_assert (link != NULL); + _dbus_assert (link->data != NULL); new_owner = (BusOwner *)link->data; new_owner_conn = new_owner->conn;