]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Add some OOM paths to the test-privserver test
authorPhilip Withnall <withnall@endlessm.com>
Thu, 9 Feb 2017 09:35:49 +0000 (09:35 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 13 Feb 2017 16:01:56 +0000 (16:01 +0000)
This is mostly pointless, but should shut Coverity up.

Coverity ID: 54693
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99722
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
test/name-test/test-privserver.c

index 535039d8021bd1cbaf768001c7ff80f46d8044fe..c6de7348478085104b8c253efb1e1f12da48abf4 100644 (file)
@@ -45,11 +45,20 @@ filter_session_message (DBusConnection     *connection,
                                    "GetPrivateAddress"))
     {
        DBusMessage *reply;
+
        reply = dbus_message_new_method_return (message);
-       dbus_message_append_args (reply, DBUS_TYPE_STRING, 
-                                 &(testdata->private_addr), DBUS_TYPE_INVALID);
-       dbus_connection_send (connection, reply, NULL);
+       if (reply == NULL)
+         die ("OOM");
+       if (!dbus_message_append_args (reply, DBUS_TYPE_STRING,
+                                      &(testdata->private_addr),
+                                      DBUS_TYPE_INVALID))
+         die ("OOM");
+
+       if (!dbus_connection_send (connection, reply, NULL))
+         die ("Error sending message");
+
        dbus_message_unref (reply);
+
        return DBUS_HANDLER_RESULT_HANDLED;
     }
   else if (dbus_message_is_method_call (message,