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
11
src/server.c
11
src/server.c
|
@ -138,11 +138,18 @@ static void tcp_connection_destroy(tcp_connection *conn)
|
||||||
|
|
||||||
if (conn->fd >= 0)
|
if (conn->fd >= 0)
|
||||||
(void) _getdns_closesocket(conn->fd);
|
(void) _getdns_closesocket(conn->fd);
|
||||||
GETDNS_FREE(*mf, conn->read_buf);
|
|
||||||
|
|
||||||
for (cur = conn->to_write; cur; cur = next) {
|
if (conn->read_buf) {
|
||||||
|
GETDNS_FREE(*mf, conn->read_buf);
|
||||||
|
conn->read_buf = NULL;
|
||||||
|
}
|
||||||
|
if ((cur = conn->to_write)) {
|
||||||
|
while (cur) {
|
||||||
next = cur->next;
|
next = cur->next;
|
||||||
GETDNS_FREE(*mf, cur);
|
GETDNS_FREE(*mf, cur);
|
||||||
|
cur = next;
|
||||||
|
}
|
||||||
|
conn->to_write = NULL;
|
||||||
}
|
}
|
||||||
if (conn->to_answer > 0)
|
if (conn->to_answer > 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue