[gssdp/wip/phako/ci: 13/14] all: Minor scan-build fixes
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp/wip/phako/ci: 13/14] all: Minor scan-build fixes
- Date: Sat, 29 May 2021 13:54:07 +0000 (UTC)
commit cf1a570c474951e4a8f1ceeb5a343b9da50426e2
Author: Jens Georg <mail jensge org>
Date: Sat May 29 15:30:59 2021 +0200
all: Minor scan-build fixes
libgssdp/gssdp-net-posix.c | 4 +---
tests/test-functional.c | 25 +++++++++++++------------
tests/test-regression.c | 6 +++++-
3 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/libgssdp/gssdp-net-posix.c b/libgssdp/gssdp-net-posix.c
index eb4b238..7df2452 100644
--- a/libgssdp/gssdp-net-posix.c
+++ b/libgssdp/gssdp-net-posix.c
@@ -465,7 +465,7 @@ gssdp_net_get_host_ip (GSSDPNetworkDevice *device)
/*
* Now go through the devices we consider worthy
*/
- family = G_SOCKET_FAMILY_INVALID;
+ family = device->address_family;
/* If we have an address, its family will take precendence.
* Otherwise take the family from the client's config
@@ -483,8 +483,6 @@ gssdp_net_get_host_ip (GSSDPNetworkDevice *device)
g_free (addr);
g_clear_object (&device->host_addr);
}
- } else {
- family = device->address_family;
}
for (ifaceptr = up_ifaces;
diff --git a/tests/test-functional.c b/tests/test-functional.c
index 81d6e6d..6f03b46 100644
--- a/tests/test-functional.c
+++ b/tests/test-functional.c
@@ -208,6 +208,7 @@ test_discovery_ssdp_all (void)
G_CALLBACK (on_test_discovery_ssdp_all_resource_unavailable),
&data);
g_main_loop_run (data.loop);
+ g_signal_handler_disconnect (browser, signal_id);
g_assert (data.found);
@@ -262,6 +263,7 @@ test_discovery_upnp_rootdevice (void)
G_CALLBACK (on_test_discovery_ssdp_all_resource_unavailable),
&data);
g_main_loop_run (data.loop);
+ g_signal_handler_disconnect (browser, signal_id);
g_assert (data.found);
@@ -316,6 +318,7 @@ test_discovery_uuid (void)
G_CALLBACK (on_test_discovery_ssdp_all_resource_unavailable),
&data);
g_main_loop_run (data.loop);
+ g_signal_handler_disconnect (browser, signal_id);
g_assert (data.found);
@@ -379,12 +382,12 @@ test_discovery_versioned (void)
g_timeout_add_seconds (1,
test_discovery_send_packet,
create_byebye_message ("MyService:1"));
- signal_id = g_signal_connect (browser,
- "resource-available",
- G_CALLBACK (on_resource_available_assert_not_reached),
- NULL);
+ g_signal_connect (browser,
+ "resource-available",
+ G_CALLBACK (on_resource_available_assert_not_reached),
+ NULL);
g_source_remove (timeout_id);
- timeout_id = g_timeout_add_seconds (5, quit_loop, data.loop);
+ g_timeout_add_seconds (5, quit_loop, data.loop);
g_main_loop_run (data.loop);
g_object_unref (browser);
@@ -435,10 +438,11 @@ test_discovery_versioned_backwards_compatible (void)
g_timeout_add_seconds (1,
test_discovery_send_packet,
create_byebye_message (VERSIONED_NT_2));
- signal_id = g_signal_connect (browser,
- "resource-unavailable",
- G_CALLBACK (on_test_discovery_ssdp_all_resource_unavailable),
- &data);
+ g_signal_connect (
+ browser,
+ "resource-unavailable",
+ G_CALLBACK (on_test_discovery_ssdp_all_resource_unavailable),
+ &data);
g_main_loop_run (data.loop);
g_assert (data.found);
@@ -489,9 +493,6 @@ test_discovery_versioned_ignore_older (void)
int main(int argc, char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/functional/resource-group/discovery/ssdp:all",
diff --git a/tests/test-regression.c b/tests/test-regression.c
index c3013ab..9bdb021 100644
--- a/tests/test-regression.c
+++ b/tests/test-regression.c
@@ -243,6 +243,9 @@ static void test_bgo682099 (void)
g_idle_add (unref_object, browser);
g_timeout_add_seconds (10, quit_loop, loop);
g_main_loop_run (loop);
+ g_signal_handler_disconnect (browser, signal_id);
+ g_object_unref (browser);
+ g_main_loop_unref (loop);
}
/* END Regression test
@@ -363,7 +366,8 @@ static void test_bgo724030 (void)
loop);
g_main_loop_run (loop); /* unavailable + available */
g_main_loop_run (loop); /* unavailable */
- unref_object(browser);
+ g_signal_handler_disconnect (browser, available_signal_id);
+ g_object_unref (browser);
}
/* END Regression test
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]