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: 0eb7617504
This commit is contained in:
Thomas Haller 2017-05-19 19:15:17 +02:00
parent ac436dc2c4
commit d5c857307e

View file

@ -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)