Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH] network: Change func. signature
@ 2020-06-10  1:23 Tim Kourt
  2020-06-10  3:01 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Kourt @ 2020-06-10  1:23 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 3523 bytes --]

Change signature of network_connect_new_hidden_network to take
reference to the caller's l_dbus_message struct. This allows to
set the caller's l_dbus_message struct to NULL after replying in
the case of a failure.

==201==    at 0x467C15: l_dbus_message_unref (dbus-message.c:412)
==201==    by 0x412A51: station_hidden_network_scan_results (station.c:2504)
==201==    by 0x41EAEA: scan_finished (scan.c:1505)
==201==    by 0x41EC10: get_scan_done (scan.c:1535)
==201==    by 0x462592: destroy_request (genl.c:673)
==201==    by 0x462987: process_unicast (genl.c:988)
==201==    by 0x462987: received_data (genl.c:1087)
==201==    by 0x45F5A2: io_callback (io.c:126)
==201==    by 0x45E8FD: l_main_iterate (main.c:474)
==201==    by 0x45E9BB: l_main_run (main.c:521)
==201==    by 0x45EBCA: l_main_run_with_signal (main.c:643)
==201==    by 0x403B15: main (main.c:512)
---
 src/network.c | 12 ++++++------
 src/network.h |  2 +-
 src/station.c |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/network.c b/src/network.c
index c08d7e72..170db3e5 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1166,7 +1166,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
 }
 
 void network_connect_new_hidden_network(struct network *network,
-						struct l_dbus_message *message)
+						struct l_dbus_message **message)
 {
 	struct station *station = network->station;
 	struct scan_bss *bss;
@@ -1183,7 +1183,7 @@ void network_connect_new_hidden_network(struct network *network,
 	bss = network_bss_select(network, true);
 	if (!bss) {
 		/* This should never happened for the hidden networks. */
-		error = dbus_error_not_supported(message);
+		error = dbus_error_not_supported(*message);
 		goto reply_error;
 	}
 
@@ -1192,13 +1192,13 @@ void network_connect_new_hidden_network(struct network *network,
 
 	switch (network_get_security(network)) {
 	case SECURITY_PSK:
-		error = network_connect_psk(network, bss, message);
+		error = network_connect_psk(network, bss, *message);
 		break;
 	case SECURITY_NONE:
-		station_connect_network(station, network, bss, message);
+		station_connect_network(station, network, bss, *message);
 		return;
 	default:
-		error = dbus_error_not_supported(message);
+		error = dbus_error_not_supported(*message);
 		break;
 	}
 
@@ -1208,7 +1208,7 @@ void network_connect_new_hidden_network(struct network *network,
 	return;
 
 reply_error:
-	dbus_pending_reply(&message, error);
+	dbus_pending_reply(message, error);
 }
 
 void network_blacklist_add(struct network *network, struct scan_bss *bss)
diff --git a/src/network.h b/src/network.h
index 8e0ed636..fbb120a7 100644
--- a/src/network.h
+++ b/src/network.h
@@ -70,7 +70,7 @@ int network_rank_compare(const void *a, const void *b, void *user);
 void network_rank_update(struct network *network, bool connected);
 
 void network_connect_new_hidden_network(struct network *network,
-						struct l_dbus_message *message);
+					struct l_dbus_message **message);
 
 void network_blacklist_add(struct network *network, struct scan_bss *bss);
 
diff --git a/src/station.c b/src/station.c
index 583016ab..87fadc3f 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2500,7 +2500,7 @@ next:
 
 	network = network_psk ? : network_open;
 
-	network_connect_new_hidden_network(network, msg);
+	network_connect_new_hidden_network(network, &msg);
 	l_dbus_message_unref(msg);
 
 	return true;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] network: Change func. signature
  2020-06-10  1:23 [PATCH] network: Change func. signature Tim Kourt
@ 2020-06-10  3:01 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2020-06-10  3:01 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

Hi Tim,

On 6/9/20 8:23 PM, Tim Kourt wrote:
> Change signature of network_connect_new_hidden_network to take
> reference to the caller's l_dbus_message struct. This allows to
> set the caller's l_dbus_message struct to NULL after replying in
> the case of a failure.
> 
> ==201==    at 0x467C15: l_dbus_message_unref (dbus-message.c:412)
> ==201==    by 0x412A51: station_hidden_network_scan_results (station.c:2504)
> ==201==    by 0x41EAEA: scan_finished (scan.c:1505)
> ==201==    by 0x41EC10: get_scan_done (scan.c:1535)
> ==201==    by 0x462592: destroy_request (genl.c:673)
> ==201==    by 0x462987: process_unicast (genl.c:988)
> ==201==    by 0x462987: received_data (genl.c:1087)
> ==201==    by 0x45F5A2: io_callback (io.c:126)
> ==201==    by 0x45E8FD: l_main_iterate (main.c:474)
> ==201==    by 0x45E9BB: l_main_run (main.c:521)
> ==201==    by 0x45EBCA: l_main_run_with_signal (main.c:643)
> ==201==    by 0x403B15: main (main.c:512)
> ---
>   src/network.c | 12 ++++++------
>   src/network.h |  2 +-
>   src/station.c |  2 +-
>   3 files changed, 8 insertions(+), 8 deletions(-)
> 

Applied after rewording the commit header slightly.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-10  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-10  1:23 [PATCH] network: Change func. signature Tim Kourt
2020-06-10  3:01 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox