From 839aa1bb97298f419d3bd9ddbed03c0680dfecf7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 14 Jan 2011 14:33:23 +0000 Subject: [PATCH 1/2] dbus_bus_set_unique_name, dbus_bus_get_unique_name: remember to unlock on OOM --- dbus/dbus-bus.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index 92ec20e..f81f859 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -769,7 +769,7 @@ dbus_bus_set_unique_name (DBusConnection *connection, const char *unique_name) { BusData *bd; - dbus_bool_t success; + dbus_bool_t success = FALSE; _dbus_return_val_if_fail (connection != NULL, FALSE); _dbus_return_val_if_fail (unique_name != NULL, FALSE); @@ -778,13 +778,14 @@ dbus_bus_set_unique_name (DBusConnection *connection, bd = ensure_bus_data (connection); if (bd == NULL) - return FALSE; + goto finally; _dbus_assert (bd->unique_name == NULL); bd->unique_name = _dbus_strdup (unique_name); success = bd->unique_name != NULL; - + +finally: _DBUS_UNLOCK (bus_datas); return success; @@ -812,7 +813,7 @@ const char* dbus_bus_get_unique_name (DBusConnection *connection) { BusData *bd; - const char *unique_name; + const char *unique_name = NULL; _dbus_return_val_if_fail (connection != NULL, NULL); @@ -820,12 +821,13 @@ dbus_bus_get_unique_name (DBusConnection *connection) bd = ensure_bus_data (connection); if (bd == NULL) - return NULL; + goto finally; unique_name = bd->unique_name; +finally: _DBUS_UNLOCK (bus_datas); - + return unique_name; } -- 1.7.2.3