diff options
author | Thomas Haller <thaller@redhat.com> | 2022-04-02 10:34:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-04-08 16:27:00 +0200 |
commit | a8e96e3c4b539391833b74432c3200df4e3a8223 (patch) | |
tree | e8161c99bf7fe52ad24852dbf8fa895a2934107c | |
parent | 41b56cb2b9397407d24e00f95ba4ffb009212040 (diff) |
platform: move known_subnets variable to inner scope in nm_platform_ip_address_sync()
(cherry picked from commit e1431b43a2e02bdd010474df40ccf4417e8b7d08)
-rw-r--r-- | src/libnm-platform/nm-platform.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index af9e2bbf9f..0536f1bd3d 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3969,7 +3969,6 @@ nm_platform_ip_address_sync(NMPlatform *self, NMPLookup lookup; gs_unref_hashtable GHashTable *known_addresses_idx = NULL; gs_unref_ptrarray GPtrArray *plat_addresses = NULL; - GHashTable *known_subnets = NULL; gboolean success; guint i_plat; guint i_know; @@ -4031,9 +4030,10 @@ nm_platform_ip_address_sync(NMPlatform *self, if (nm_g_ptr_array_len(plat_addresses) > 0) { /* Delete addresses that interfere with our intended order. */ if (IS_IPv4) { + GHashTable *known_subnets = NULL; + GHashTable *plat_subnets; gs_free bool *plat_handled_to_free = NULL; bool *plat_handled = NULL; - GHashTable *plat_subnets; /* For IPv4, we only consider it a conflict for addresses in the same * subnet. That's where kernel will assign a primary/secondary flag. @@ -4129,6 +4129,7 @@ nm_platform_ip_address_sync(NMPlatform *self, } } ip4_addr_subnets_destroy_index(plat_subnets, plat_addresses); + ip4_addr_subnets_destroy_index(known_subnets, known_addresses); } else { guint known_addresses_len; IP6AddrScope cur_scope; @@ -4239,9 +4240,6 @@ next_plat:; if (!known_addresses) return TRUE; - if (IS_IPv4) - ip4_addr_subnets_destroy_index(known_subnets, known_addresses); - success = TRUE; /* Add missing addresses. New addresses are added by kernel with top |