From 5ccb8ce17a161fa7e926a1644a4c1aadbf74c002 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Fri, 12 Feb 2021 11:04:26 +0100 Subject: iwd: Fix the leaks in get_agent_request_network_path Don't request new copies of strings from g_variant_get() to avoid leaking memory as pointed out by Thomas Haller. Fixes: dc0e31fb7014 ('iwd: Add the wifi.iwd.autoconnect setting') --- src/core/devices/wifi/nm-device-iwd.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/devices/wifi/nm-device-iwd.c b/src/core/devices/wifi/nm-device-iwd.c index f0de90d3fc..95ade44b58 100644 --- a/src/core/devices/wifi/nm-device-iwd.c +++ b/src/core/devices/wifi/nm-device-iwd.c @@ -1282,15 +1282,13 @@ get_agent_request_network_path(GDBusMethodInvocation *invocation) const char *network_path = NULL; if (nm_streq(method_name, "RequestPassphrase")) - g_variant_get(params, "(o)", &network_path); + g_variant_get(params, "(&o)", &network_path); else if (nm_streq(method_name, "RequestPrivateKeyPassphrase")) - g_variant_get(params, "(o)", &network_path); + g_variant_get(params, "(&o)", &network_path); else if (nm_streq(method_name, "RequestUserNameAndPassword")) - g_variant_get(params, "(o)", &network_path); - else if (nm_streq(method_name, "RequestUserPassword")) { - const char *user; - g_variant_get(params, "(os)", &network_path, &user); - } + g_variant_get(params, "(&o)", &network_path); + else if (nm_streq(method_name, "RequestUserPassword")) + g_variant_get(params, "(&os)", &network_path, NULL); return network_path; } -- cgit v1.2.1