mirror of https://github.com/getdnsapi/getdns.git
Track readbuf free's
As tcp_connection_destroy() might be called more than once per connection (depending on outstanding work)
This commit is contained in:
parent
155b035cd8
commit
d38f233a80
15
src/server.c
15
src/server.c
|
@ -138,11 +138,18 @@ static void tcp_connection_destroy(tcp_connection *conn)
|
|||
|
||||
if (conn->fd >= 0)
|
||||
(void) _getdns_closesocket(conn->fd);
|
||||
GETDNS_FREE(*mf, conn->read_buf);
|
||||
|
||||
for (cur = conn->to_write; cur; cur = next) {
|
||||
next = cur->next;
|
||||
GETDNS_FREE(*mf, cur);
|
||||
if (conn->read_buf) {
|
||||
GETDNS_FREE(*mf, conn->read_buf);
|
||||
conn->read_buf = NULL;
|
||||
}
|
||||
if ((cur = conn->to_write)) {
|
||||
while (cur) {
|
||||
next = cur->next;
|
||||
GETDNS_FREE(*mf, cur);
|
||||
cur = next;
|
||||
}
|
||||
conn->to_write = NULL;
|
||||
}
|
||||
if (conn->to_answer > 0)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue