From: Simon McVittie Date: Mon, 25 Jun 2012 11:20:45 +0000 (+0100) Subject: dbus_pending_call_set_notify: don't leave the connection locked on OOM X-Git-Tag: dbus-1.6.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e29efffd88881eb765ded94e9ebdbb5a76d2fd5f;p=thirdparty%2Fdbus.git dbus_pending_call_set_notify: don't leave the connection locked on OOM Bug: https://bugs.freedesktop.org/show_bug.cgi?id=51032 Signed-off-by: Simon McVittie Reviewed-by: Lennart Poettering --- diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index 8a9d2f499..62c6c7484 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -631,6 +631,8 @@ dbus_pending_call_set_notify (DBusPendingCall *pending, void *user_data, DBusFreeFunction free_user_data) { + dbus_bool_t ret = FALSE; + _dbus_return_val_if_fail (pending != NULL, FALSE); CONNECTION_LOCK (pending->connection); @@ -638,13 +640,15 @@ dbus_pending_call_set_notify (DBusPendingCall *pending, /* could invoke application code! */ if (!_dbus_pending_call_set_data_unlocked (pending, notify_user_data_slot, user_data, free_user_data)) - return FALSE; + goto out; pending->function = function; + ret = TRUE; +out: CONNECTION_UNLOCK (pending->connection); - return TRUE; + return ret; } /**