From 9e8f2f4fe3243e5ae24260bd34c3a4f03b718938 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 9 Feb 2017 09:35:49 +0000 Subject: [PATCH] test: Add some OOM paths to the test-privserver test This is mostly pointless, but should shut Coverity up. Coverity ID: 54693 Signed-off-by: Philip Withnall https://bugs.freedesktop.org/show_bug.cgi?id=99722 --- test/name-test/test-privserver.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/name-test/test-privserver.c b/test/name-test/test-privserver.c index 535039d..c6de734 100644 --- a/test/name-test/test-privserver.c +++ b/test/name-test/test-privserver.c @@ -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, -- 2.9.3