]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-message-factory: Add some missing OOM paths to an internal test
authorPhilip Withnall <withnall@endlessm.com>
Fri, 10 Feb 2017 11:04:18 +0000 (11:04 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 13 Feb 2017 16:06:33 +0000 (16:06 +0000)
Coverity ID: 54692
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99724
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-message-factory.c

index a3e2b6a19dcf57c05e18c7d14837e8d5d013be7b..23e13d8e1d9e00898228473d3757301ecc7d38fa 100644 (file)
@@ -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;
     }