summaryrefslogtreecommitdiffstats
path: root/python-ethtool/etherinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'python-ethtool/etherinfo.c')
-rw-r--r--python-ethtool/etherinfo.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c
index 2091a3c..41a55fe 100644
--- a/python-ethtool/etherinfo.c
+++ b/python-ethtool/etherinfo.c
@@ -66,7 +66,9 @@ void free_ipv6addresses(struct ipv6address *ptr) {
while( ipv6ptr ) {
struct ipv6address *tmp = ipv6ptr->next;
- free(ipv6ptr->address);
+ if( ipv6ptr->address ) {
+ free(ipv6ptr->address);
+ }
free(ipv6ptr);
ipv6ptr = tmp;
}
@@ -313,10 +315,6 @@ int get_etherinfo(struct etherinfo *ethinf, struct nl_handle *nlc, nlQuery query
break;
case NLQRY_ADDR:
- /* Remove old IPv6 information we might have */
- free_ipv6addresses(ethinf->ipv6_addresses);
- ethinf->ipv6_addresses = NULL;
-
/* Extract IP address information */
addr_cache = rtnl_addr_alloc_cache(nlc);
addr = rtnl_addr_alloc();