From 98b00d390ebb2ac740937b6537084b92ae49a28f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 8 Feb 2017 10:09:04 +0000 Subject: [PATCH] test: Add some OOM paths to the dbus-daemon-eavesdrop path This will shut Coverity up. All the paths are checks on the return value from dbus_message_set_destination(). Coverity IDs: 54822, 54823, 54824, 54825 Signed-off-by: Philip Withnall https://bugs.freedesktop.org/show_bug.cgi?id=99712 --- test/dbus-daemon-eavesdrop.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/dbus-daemon-eavesdrop.c b/test/dbus-daemon-eavesdrop.c index 4198578..9dac06f 100644 --- a/test/dbus-daemon-eavesdrop.c +++ b/test/dbus-daemon-eavesdrop.c @@ -88,11 +88,12 @@ sender_send_unicast_to_sender (Fixture *f) signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_SIGNAL_NAME); - dbus_message_set_destination (signal, dbus_bus_get_unique_name (f->sender)); - if (signal == NULL) g_error ("OOM"); + if (!dbus_message_set_destination (signal, dbus_bus_get_unique_name (f->sender))) + g_error ("OOM"); + if (!dbus_connection_send (f->sender, signal, NULL)) g_error ("OOM"); @@ -109,11 +110,12 @@ sender_send_unicast_to_receiver (Fixture *f) DBusMessage *signal; signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_SIGNAL_NAME); - dbus_message_set_destination (signal, dbus_bus_get_unique_name (f->receiver)); - if (signal == NULL) g_error ("OOM"); + if (!dbus_message_set_destination (signal, dbus_bus_get_unique_name (f->receiver))) + g_error ("OOM"); + if (!dbus_connection_send (f->sender, signal, NULL)) g_error ("OOM"); @@ -128,11 +130,12 @@ sender_send_broadcast (Fixture *f) DBusMessage *signal; signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_SIGNAL_NAME); - dbus_message_set_destination (signal, NULL); - if (signal == NULL) g_error ("OOM"); + if (!dbus_message_set_destination (signal, NULL)) + g_error ("OOM"); + if (!dbus_connection_send (f->sender, signal, NULL)) g_error ("OOM"); @@ -152,11 +155,12 @@ sender_send_stopper (Fixture *f) DBusMessage *signal; signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_STOPPER_NAME); - dbus_message_set_destination (signal, NULL); - if (signal == NULL) g_error ("OOM"); + if (!dbus_message_set_destination (signal, NULL)) + g_error ("OOM"); + if (!dbus_connection_send (f->sender, signal, NULL)) g_error ("OOM"); -- 2.9.3