all: fix a couple more gvariant iteration leaks
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 8 Mar 2016 15:45:25 +0000 (16:45 +0100)
committerLubomir Rintel <lkundrak@v3.sk>
Tue, 8 Mar 2016 16:44:15 +0000 (17:44 +0100)
callouts/nm-dispatcher-utils.c
libnm-core/nm-utils.c
src/devices/bluetooth/nm-bluez5-manager.c
src/settings/nm-agent-manager.c

index f7f9e96..015bb07 100644 (file)
@@ -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;
 }
index 52d4e8b..10d54fa 100644 (file)
@@ -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;
index 8fcfaed..66d171b 100644 (file)
@@ -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);
index 455871d..48a7da7 100644 (file)
@@ -930,6 +930,7 @@ set_secrets_not_required (NMConnection *connection, GVariant *dict)
                                g_variant_unref (val);
                        }
                }
+               g_variant_unref (setting_dict);
        }
 }