diff options
author | pdw <> | 2014-01-01 12:01:21 +0000 |
---|---|---|
committer | pdw <> | 2014-01-01 12:01:21 +0000 |
commit | 029625219bf401345016414883866d4beddfe0b6 (patch) | |
tree | 09c446dbb70fa7299fb40952997435653b41bf9f | |
parent | ddba33572147e14df7270fbd8e360b3d3eaefd36 (diff) | |
download | iftop-029625219bf401345016414883866d4beddfe0b6.zip |
Fix for memory leak when DNS resolution is turned off.
Patch by Olivier Allard-Jacquin <olivieraj@free.fr>
Debian bug ID #677141: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677141
-rw-r--r-- | resolver.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -472,15 +472,15 @@ void resolve(int af, void* addr, char* result, int buflen) { int added = 0; struct addr_storage *raddr; - raddr = malloc(sizeof *raddr); - memset(raddr, 0, sizeof *raddr); - raddr->af = af; - raddr->len = (af == AF_INET ? sizeof(struct in_addr) - : sizeof(struct in6_addr)); - memcpy(&raddr->addr, addr, raddr->len); - if(options.dnsresolution == 1) { + raddr = malloc(sizeof *raddr); + memset(raddr, 0, sizeof *raddr); + raddr->af = af; + raddr->len = (af == AF_INET ? sizeof(struct in_addr) + : sizeof(struct in6_addr)); + memcpy(&raddr->addr, addr, raddr->len); + pthread_mutex_lock(&resolver_queue_mutex); if(hash_find(ns_hash, raddr, u_hostname.void_pp) == HASH_STATUS_OK) { |