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
This commit is contained in:
Emeric Brun 2021-02-15 15:20:19 +01:00 committed by Christopher Faulet
parent 0e40fda16a
commit 267221557f

View File

@ -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;
}