diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-19 19:15:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-19 19:36:26 +0200 |
commit | d5c857307e17d4be53a7546629e23519df539de9 (patch) | |
tree | b1adfbca1fc664e343b579bf37e5021e24a43074 | |
parent | ac436dc2c419d6b84ff3187ddfe83e53de168329 (diff) | |
download | NetworkManager-d5c857307e17d4be53a7546629e23519df539de9.tar.gz |
wifi: properly handle floating GVariant in supplicant_iface_wps_credentials_cb()
g_variant_new_parsed() returns a floating reference. Later, we pass
the floating reference to nm_settings_connection_new_secrets(),
but don't transfer ownership.
That might not be a bug (I didn't check), but it requires that
nm_settings_connection_new_secrets() does not take a reference
to the secrets variant.
Convert the floating reference to a real reference to avoid
this dangerous pattern.
Fixes: 0eb76175047057fc466814632f25bfaf10566c37
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index f1be2a3e4e..dfbf5818e0 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -1860,6 +1860,7 @@ supplicant_iface_wps_credentials_cb (NMSupplicantInterface *iface, secrets = g_variant_new_parsed ("[{%s, [{%s, <%s>}]}]", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PSK, psk); + g_variant_ref_sink (secrets); } } if (!secrets) |