summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-08-14 09:48:45 +1000
committerKeith Packard <keithp@keithp.com>2009-08-25 19:46:15 -0700
commit397f7c42cd775f1dbfced58bc1dfaead48e86440 (patch)
treefba6a282d4e4d6612ddc1d48fd98c5de19a26209
parent55c26d8e4d110b689aea9d806e9d4fa7bbbdd32a (diff)
config: don't shutdown the libhal ctx if it failed to initialize (#23213)
Regression introduced by b1c3dc6ae226db178420e3b5f297b94afc87c94c. Shutting down the libhal_ctx if the init failed may cause an abort. This can happen if hald is not yet running at server startup. X.Org Bug 23213 <http://bugs.freedesktop.org/show_bug.cgi?id=23213> Tested-by: Stefan Dirsch Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 49046088f10cceaea7da97401d742d3fb59371f5)
-rw-r--r--config/hal.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/config/hal.c b/config/hal.c
index 59bff6613..28f55a02f 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -489,13 +489,13 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
- goto out_ctx;
+ goto out_err;
}
if (!libhal_ctx_init(info->hal_ctx, &error)) {
LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
error.name ? error.name : "unknown error",
error.message ? error.message : "null");
- goto out_ctx;
+ goto out_err;
}
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
@@ -526,19 +526,20 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
out_ctx:
dbus_error_free(&error);
- if (info->hal_ctx) {
- if (!libhal_ctx_shutdown(info->hal_ctx, &error)) {
- LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
- dbus_error_free(&error);
- }
- libhal_ctx_free(info->hal_ctx);
+ if (!libhal_ctx_shutdown(info->hal_ctx, &error)) {
+ LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
+ dbus_error_free(&error);
}
out_err:
dbus_error_free(&error);
+ if (info->hal_ctx) {
+ libhal_ctx_free(info->hal_ctx);
+ }
+
info->hal_ctx = NULL;
info->system_bus = NULL;