From b9a52113de86a41dfc34460266538ef50ef31263 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 28 Mar 2011 17:23:34 +0100 Subject: [PATCH 12/25] marshal_struct: simplify teardown, and abandon broken containers --- dbus/dbus-gvalue.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dbus/dbus-gvalue.c b/dbus/dbus-gvalue.c index 2335a14..0cba32b 100644 --- a/dbus/dbus-gvalue.c +++ b/dbus/dbus-gvalue.c @@ -1768,19 +1768,20 @@ marshal_struct (DBusMessageIter *iter, { g_value_init (&val, dbus_g_type_get_struct_member_type (G_VALUE_TYPE(value), i)); + if (!dbus_g_type_struct_get_member (value, i, &val)) - return FALSE; + goto abandon; + if (!_dbus_gvalue_marshal (&subiter, &val)) - return FALSE; + goto abandon; + g_value_unset(&val); } - if (!dbus_message_iter_close_container (iter, &subiter)) - goto oom; + return dbus_message_iter_close_container (iter, &subiter); - return TRUE; - oom: - g_error ("out of memory"); +abandon: + dbus_message_iter_abandon_container (iter, &subiter); return FALSE; } -- 1.7.4.1