Handle error from libhal_find_device_by_capability. libhal_find_device_by_capability may encounter errors, e.g. due to a broken HAL configuration. These errors have to be dealt with before the list of devices is traversed. Otherwise a SIGSEGV might occur. 2009-07-22 Martin von Gagern References: http://bugs.gentoo.org/278760Index: xorg-server-1.6.2/config/hal.c =================================================================== Index: xorg-server-1.6.2/config/hal.c =================================================================== --- xorg-server-1.6.2.orig/config/hal.c +++ xorg-server-1.6.2/config/hal.c @@ -506,7 +506,12 @@ connect_and_register(DBusConnection *con devices = libhal_find_device_by_capability(info->hal_ctx, "input", &num_devices, &error); + if (dbus_error_is_set(&error)) { /* FIXME: Get default devices if error is set. */ + LogMessage(X_ERROR, "config/hal: couldn't find input device: %s (%s)\n", + error.name, error.message); + goto out_ctx2; + } for (i = 0; i < num_devices; i++) device_added(info->hal_ctx, devices[i]); libhal_free_string_array(devices); @@ -516,10 +521,12 @@ connect_and_register(DBusConnection *con return TRUE; out_ctx2: + dbus_error_free(&error); if (!libhal_ctx_shutdown(info->hal_ctx, &error)) LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n", error.name, error.message); out_ctx: + dbus_error_free(&error); libhal_ctx_free(info->hal_ctx); out_err: dbus_error_free(&error);