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
This commit is contained in:
@@ -472,6 +472,8 @@ void resolve(int af, void* addr, char* result, int buflen) {
|
|||||||
int added = 0;
|
int added = 0;
|
||||||
struct addr_storage *raddr;
|
struct addr_storage *raddr;
|
||||||
|
|
||||||
|
if(options.dnsresolution == 1) {
|
||||||
|
|
||||||
raddr = malloc(sizeof *raddr);
|
raddr = malloc(sizeof *raddr);
|
||||||
memset(raddr, 0, sizeof *raddr);
|
memset(raddr, 0, sizeof *raddr);
|
||||||
raddr->af = af;
|
raddr->af = af;
|
||||||
@@ -479,8 +481,6 @@ void resolve(int af, void* addr, char* result, int buflen) {
|
|||||||
: sizeof(struct in6_addr));
|
: sizeof(struct in6_addr));
|
||||||
memcpy(&raddr->addr, addr, raddr->len);
|
memcpy(&raddr->addr, addr, raddr->len);
|
||||||
|
|
||||||
if(options.dnsresolution == 1) {
|
|
||||||
|
|
||||||
pthread_mutex_lock(&resolver_queue_mutex);
|
pthread_mutex_lock(&resolver_queue_mutex);
|
||||||
|
|
||||||
if(hash_find(ns_hash, raddr, u_hostname.void_pp) == HASH_STATUS_OK) {
|
if(hash_find(ns_hash, raddr, u_hostname.void_pp) == HASH_STATUS_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user