From 267221557fe2a0641f3ab93d546a7580852d5809 Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Mon, 15 Feb 2021 15:20:19 +0100 Subject: [PATCH] BUG/MEDIUM: dns: fix multiple double close on fd in dns.c It seems that fd_delete perform the close of the file descriptor Se we must not close the fd once again after that. This should fix issues #1128, #1130 and #1131 --- src/dns.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/dns.c b/src/dns.c index 58c68d7..cb30bff 100644 --- a/src/dns.c +++ b/src/dns.c @@ -117,7 +117,6 @@ int dns_send_nameserver(struct dns_nameserver *ns, void *buf, size_t len) } ns->counters->snd_error++; fd_delete(fd); - close(fd); dgram->t.sock.fd = -1; return -1; } @@ -164,7 +163,6 @@ ssize_t dns_recv_nameserver(struct dns_nameserver *ns, void *data, size_t size) return 0; } fd_delete(fd); - close(fd); dgram->t.sock.fd = -1; return -1; } @@ -342,7 +340,6 @@ static void dns_resolve_send(struct dgram_conn *dgram) } ns->counters->snd_error++; fd_delete(fd); - close(fd); fd = dgram->t.sock.fd = -1; goto out; } -- 1.7.10.4