settings: fix memory leak in Update2() options parsing

The "{&sv}" format in g_variant_iter_next() borrows the key but creates
a new reference for the value.

Fixes: 82d16789a5 ('settings-connection: add a "plugin" argument to Update2()')
This commit is contained in:
Beniamino Galvani 2026-06-01 10:14:12 +02:00
parent fd037132e7
commit 08d9476708

View file

@ -1866,6 +1866,8 @@ impl_settings_connection_update2(NMDBusObject *obj,
g_variant_iter_init(&iter, args);
while (g_variant_iter_next(&iter, "{&sv}", &args_name, &args_value)) {
gs_unref_variant GVariant *args_value_unref = args_value;
if (plugin_name == NULL && nm_streq(args_name, "plugin")
&& g_variant_is_of_type(args_value, G_VARIANT_TYPE_STRING)) {
plugin_name = g_variant_dup_string(args_value, NULL);