From d7674588ea235c9a2b411dfb1afd9ff80c1994f6 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 10 Feb 2017 11:04:18 +0000 Subject: [PATCH] dbus-message-factory: Add some missing OOM paths to an internal test Coverity ID: 54692 Signed-off-by: Philip Withnall https://bugs.freedesktop.org/show_bug.cgi?id=99724 --- dbus/dbus-message-factory.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dbus/dbus-message-factory.c b/dbus/dbus-message-factory.c index a3e2b6a..23e13d8 100644 --- a/dbus/dbus-message-factory.c +++ b/dbus/dbus-message-factory.c @@ -362,19 +362,24 @@ message_with_nesting_levels (int levels) dbus_message_iter_init_append (message, &parents[i]); while (i < levels) { - dbus_message_iter_open_container (&parents[i], DBUS_TYPE_VARIANT, - i == (levels - 1) ? - DBUS_TYPE_INT32_AS_STRING : - DBUS_TYPE_VARIANT_AS_STRING, - &children[i]); + if (!dbus_message_iter_open_container (&parents[i], DBUS_TYPE_VARIANT, + i == (levels - 1) ? + DBUS_TYPE_INT32_AS_STRING : + DBUS_TYPE_VARIANT_AS_STRING, + &children[i])) + _dbus_assert_not_reached ("oom"); ++i; parents[i] = children[i-1]; } --i; - dbus_message_iter_append_basic (&children[i], DBUS_TYPE_INT32, &v_INT32); + + if (!dbus_message_iter_append_basic (&children[i], DBUS_TYPE_INT32, &v_INT32)) + _dbus_assert_not_reached ("oom"); + while (i >= 0) { - dbus_message_iter_close_container (&parents[i], &children[i]); + if (!dbus_message_iter_close_container (&parents[i], &children[i])) + _dbus_assert_not_reached ("oom"); --i; } -- 2.9.3