platform: move known_subnets variable to inner scope in nm_platform_ip_address_sync()

(cherry picked from commit e1431b43a2)
(cherry picked from commit a8e96e3c4b)
This commit is contained in:
Thomas Haller 2022-04-02 10:34:17 +02:00 committed by Beniamino Galvani
parent cea335c454
commit 0f0d7d801b

View file

@ -3905,7 +3905,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;
@ -3967,9 +3966,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.
@ -4065,6 +4065,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;
@ -4175,9 +4176,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