From 1c5d8d0aec40de8bb1c19f35947490cce3c3d3bd Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 8 Mar 2016 16:45:25 +0100 Subject: [PATCH] all: fix a couple more gvariant iteration leaks --- callouts/nm-dispatcher-utils.c | 1 + libnm-core/nm-utils.c | 8 ++++---- src/devices/bluetooth/nm-bluez5-manager.c | 1 + src/settings/nm-agent-manager.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index f7f9e96548..015bb070fe 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -313,6 +313,7 @@ construct_device_dhcp6_items (GSList *items, GVariant *dhcp6_config) tmp = g_variant_get_string (val, NULL); items = g_slist_prepend (items, g_strdup_printf ("DHCP6_%s=%s", ucased, tmp)); g_free (ucased); + g_variant_unref (val); } return items; } diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 52d4e8b871..10d54fa86b 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -2084,8 +2084,7 @@ nm_utils_ip_routes_from_variant (GVariant *value, if ( !g_variant_lookup (route_var, "dest", "&s", &dest) || !g_variant_lookup (route_var, "prefix", "u", &prefix)) { g_warning ("Ignoring invalid address"); - g_variant_unref (route_var); - continue; + goto next; } if (!g_variant_lookup (route_var, "next-hop", "&s", &next_hop)) next_hop = NULL; @@ -2098,8 +2097,7 @@ nm_utils_ip_routes_from_variant (GVariant *value, if (!route) { g_warning ("Ignoring invalid route: %s", error->message); g_clear_error (&error); - g_variant_unref (route_var); - continue; + goto next; } g_variant_iter_init (&attrs_iter, route_var); @@ -2113,6 +2111,8 @@ nm_utils_ip_routes_from_variant (GVariant *value, } g_ptr_array_add (routes, route); +next: + g_variant_unref (route_var); } return routes; diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index 8fcfaedf5b..66d171bf2e 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -213,6 +213,7 @@ get_managed_objects_cb (GDBusProxy *proxy, G_VARIANT_TYPE_DICTIONARY)) { device_added (proxy, path, self); } + g_variant_unref (ifaces); } g_variant_unref (variant); diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 455871de12..48a7da7b0e 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -930,6 +930,7 @@ set_secrets_not_required (NMConnection *connection, GVariant *dict) g_variant_unref (val); } } + g_variant_unref (setting_dict); } }