Skip to content

Commit a01edbc

Browse files
author
David Sommerseth
committed
Avoid duplicating IPv6 address information
In commit c52ed2c a free_ipv6addresses() call was removed, which lead to duplicated IPv6 address information in some cases. Re-add this freeing, to be sure we don't add existing information to an already existing pointer chain. Signed-off-by: David Sommerseth <davids@redhat.com>
1 parent e842b88 commit a01edbc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python-ethtool/etherinfo.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ int get_etherinfo(struct etherinfo *ethinf, struct nl_handle *nlc, nlQuery query
319319
addr_cache = rtnl_addr_alloc_cache(nlc);
320320
addr = rtnl_addr_alloc();
321321
rtnl_addr_set_ifindex(addr, ethinf->index);
322+
323+
/* Make sure we don't have any old IPv6 addresses saved */
324+
if( ethinf->ipv6_addresses ) {
325+
free_ipv6addresses(ethinf->ipv6_addresses);
326+
ethinf->ipv6_addresses = NULL;
327+
}
328+
329+
/* Retrieve all address information */
322330
nl_cache_foreach_filter(addr_cache, (struct nl_object *)addr, callback_nl_address, ethinf);
323331
rtnl_addr_put(addr);
324332
nl_cache_free(addr_cache);

0 commit comments

Comments
 (0)