From a01edbcc4148c191ac22a76a858d9dff674a0f74 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 19 Jan 2011 16:32:29 +0100 Subject: Avoid duplicating IPv6 address information In commit c52ed2cbdc5b851ebc7bc19d7c682b14a4a16ba4 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 --- python-ethtool/etherinfo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c index 3350cf9..3d2072b 100644 --- a/python-ethtool/etherinfo.c +++ b/python-ethtool/etherinfo.c @@ -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); -- cgit