From 3a2e0ba5fec9a162ff5968975ab4b5499ac13bd8 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Thu, 9 Dec 2021 09:51:09 +0100 Subject: [PATCH] Avoid assertation in bus_activation_reload() In the mentioned function a local DBusError instance is now used to fulfill the requirement of dbus_error_has_name() that the parameter 'error' must not be null. See #360 --- bus/activation.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bus/activation.c b/bus/activation.c index 19ac869a..48a44a30 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -898,6 +898,7 @@ bus_activation_reload (BusActivation *activation, { DBusList *link; char *dir; + DBusError local_error = DBUS_ERROR_INIT; if (activation->server_address != NULL) dbus_free (activation->server_address); @@ -965,13 +966,18 @@ bus_activation_reload (BusActivation *activation, } /* only fail on OOM, it is ok if we can't read the directory */ - if (!update_directory (activation, s_dir, error)) - { - if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY)) - goto failed; - else - dbus_error_free (error); - } + if (!update_directory (activation, s_dir, &local_error)) + { + if (dbus_error_has_name (&local_error, DBUS_ERROR_NO_MEMORY)) + { + dbus_move_error (&local_error, error); + goto failed; + } + else + { + dbus_error_free (&local_error); + } + } link = _dbus_list_get_next_link (directories, link); }