From d5c857307e17d4be53a7546629e23519df539de9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 19 May 2017 19:15:17 +0200 Subject: [PATCH] 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 --- src/devices/wifi/nm-device-wifi.c | 1 + 1 file changed, 1 insertion(+) 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)