]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Avoid assertation in bus_activation_reload()
authorRalf Habacker <ralf.habacker@freenet.de>
Thu, 9 Dec 2021 08:51:09 +0000 (09:51 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Thu, 9 Dec 2021 11:54:22 +0000 (12:54 +0100)
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

index 19ac869af4cff125f93c682ed125d8b6936cc7d7..48a44a306632ebd839231892bcd15877e29f95e0 100644 (file)
@@ -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);
     }