]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
tests: Don't leak pending calls
authorSimon McVittie <smcv@collabora.com>
Tue, 21 Nov 2017 12:01:23 +0000 (12:01 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 24 Nov 2017 12:19:09 +0000 (12:19 +0000)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600

test/sd-activation.c
test/uid-permissions.c

index 8e0b2af6e8abf76bbe83335f1af9efe32b956c3b..92203b70be91ba1a64f92082af21d6b49b4a7e66 100644 (file)
@@ -563,6 +563,8 @@ test_uae (Fixture *f,
   assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
   dbus_message_unref (m);
 
+  dbus_clear_pending_call (&pc);
+
   /* The fake systemd connects to the bus. */
   f->systemd = test_connect_to_bus (f->ctx, f->address);
   if (!dbus_connection_add_filter (f->systemd, systemd_filter, f, NULL))
@@ -648,6 +650,8 @@ test_uae (Fixture *f,
   assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
   dbus_message_unref (m);
 
+  dbus_clear_pending_call (&pc);
+
   while (f->systemd_message == NULL)
     test_main_context_iterate (f->ctx, TRUE);
 
@@ -897,6 +901,7 @@ test_transient_services (Fixture *f,
       assert_error_reply (m, DBUS_SERVICE_DBUS, f->caller_name,
           DBUS_ERROR_SERVICE_UNKNOWN);
 
+      dbus_clear_pending_call (&pc);
       dbus_message_unref (m);
       m = NULL;
 
@@ -930,6 +935,8 @@ test_transient_services (Fixture *f,
       assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
       dbus_message_unref (m);
       m = NULL;
+
+      dbus_clear_pending_call (&pc);
     }
 
   /* The service is present now. */
@@ -950,6 +957,8 @@ test_transient_services (Fixture *f,
         &reply, NULL))
     g_error ("OOM");
 
+  dbus_clear_pending_call (&pc);
+
   /* The mock systemd is told to start the service. */
   while (f->systemd_message == NULL)
     test_main_context_iterate (f->ctx, TRUE);
index 75bbb13fb82f3249f55d6ac1ac60cd43d3771de8..ce6d7a6b2a8481741d335cc44f160092affbde3c 100644 (file)
@@ -145,6 +145,7 @@ test_uae (Fixture *f,
       g_assert_cmpstr (dbus_message_get_signature (m), ==, "s");
     }
 
+  dbus_clear_pending_call (&pc);
   dbus_message_unref (m);
 }
 
@@ -210,6 +211,7 @@ test_monitor (Fixture *f,
       g_assert_cmpstr (dbus_message_get_signature (m), ==, "s");
     }
 
+  dbus_clear_pending_call (&pc);
   dbus_message_unref (m);
 }