From f914b2105b6c290e2b949ed3117d543b5675c86a Mon Sep 17 00:00:00 2001 From: Deepika Aggarwal Date: Mon, 7 Dec 2015 16:56:06 +0530 Subject: [PATCH] bus: reassure static analysis tool that server slot allocation can't fail. Description: This prevents coverity from reporting a possible NULL-dereference here. The NULL-dereference is not actually possible in this case, because we know that the allocation and setup were done previously. Signed-off-by: Deepika Aggarwal --- bus/bus.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bus/bus.c b/bus/bus.c index fd4ab9e..9f1daa2 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -90,19 +90,15 @@ server_get_context (DBusServer *server) BusContext *context; BusServerData *bd; - if (!dbus_server_allocate_data_slot (&server_data_slot)) - return NULL; + /* this data slot was allocated by the BusContext */ + _dbus_assert (server_data_slot >= 0); bd = BUS_SERVER_DATA (server); - if (bd == NULL) - { - dbus_server_free_data_slot (&server_data_slot); - return NULL; - } - context = bd->context; + /* every DBusServer in the dbus-daemon has gone through setup_server() */ + _dbus_assert (bd != NULL); - dbus_server_free_data_slot (&server_data_slot); + context = bd->context; return context; } -- 1.7.9.5