From da88126b7bfc3abfc77f8b18dda97517e4d6e014 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 16 Jun 2009 17:03:23 +0100 Subject: [PATCH] dbus_message_append_args_valist - abandon container In case of OOM when constructing an array, we should abandon the container to free the resources. Signed-off-by: Scott James Remnant --- dbus/dbus-message.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 30b5d6c..98c284e 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1567,8 +1567,10 @@ dbus_message_append_args_valist (DBusMessage *message, if (!dbus_message_iter_append_fixed_array (&array, element_type, value, - n_elements)) + n_elements)) { + dbus_message_iter_abandon_container (&iter, &array); goto failed; + } } else if (element_type == DBUS_TYPE_STRING || element_type == DBUS_TYPE_SIGNATURE || @@ -1589,8 +1591,10 @@ dbus_message_append_args_valist (DBusMessage *message, { if (!dbus_message_iter_append_basic (&array, element_type, - &value[i])) + &value[i])) { + dbus_message_iter_abandon_container (&iter, &array); goto failed; + } ++i; } } -- 1.6.0.5