Skip to content

Commit

Permalink
Avoid duplicating IPv6 address information
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
David Sommerseth committed Jan 19, 2011
1 parent e842b88 commit a01edbc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python-ethtool/etherinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ int get_etherinfo(struct etherinfo *ethinf, struct nl_handle *nlc, nlQuery query
addr_cache = rtnl_addr_alloc_cache(nlc);
addr = rtnl_addr_alloc();
rtnl_addr_set_ifindex(addr, ethinf->index);

/* Make sure we don't have any old IPv6 addresses saved */
if( ethinf->ipv6_addresses ) {
free_ipv6addresses(ethinf->ipv6_addresses);
ethinf->ipv6_addresses = NULL;
}

/* Retrieve all address information */
nl_cache_foreach_filter(addr_cache, (struct nl_object *)addr, callback_nl_address, ethinf);
rtnl_addr_put(addr);
nl_cache_free(addr_cache);
Expand Down

0 comments on commit a01edbc

Please sign in to comment.