diff options
author | Andrew Zaborowski <andrew.zaborowski@intel.com> | 2021-02-12 11:04:26 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-02-12 14:36:30 +0100 |
commit | 5ccb8ce17a161fa7e926a1644a4c1aadbf74c002 (patch) | |
tree | 1ac49a19403c6a61cbf09f50311403b28b6389c0 | |
parent | e23bafe5d5d1afc187a1466f6acb111db3804c60 (diff) | |
download | NetworkManager-5ccb8ce17a161fa7e926a1644a4c1aadbf74c002.tar.gz |
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')
-rw-r--r-- | src/core/devices/wifi/nm-device-iwd.c | 12 |
1 files 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; } |