* Fix for #93: fix packaging/libldns.pc Makefile rule.
* ldns-testns can answer several queries over one tcp connection,
if they arrive within 100msec of each other.
+ * Fix so that ldns-testns does not leak sockets if the read fails.
1.7.1 2019-07-26
* bugfix: Manage verification paths for OpenSSL >= 1.1.0
while(1) {
/* tcp recv */
- if (read_n_bytes(s, (uint8_t*)&tcplen, sizeof(tcplen)))
+ if (read_n_bytes(s, (uint8_t*)&tcplen, sizeof(tcplen))) {
+#ifndef USE_WINSOCK
+ close(s);
+#else
+ closesocket(s);
+#endif
return;
+ }
tcplen = ntohs(tcplen);
if(tcplen >= INBUF_SIZE) {
log_msg("query %d bytes too large, buffer %d bytes.\n",
#endif
return;
}
- if (read_n_bytes(s, inbuf, tcplen))
+ if (read_n_bytes(s, inbuf, tcplen)) {
+#ifndef USE_WINSOCK
+ close(s);
+#else
+ closesocket(s);
+#endif
return;
+ }
handle_query(inbuf, (ssize_t) tcplen, entries, count, transport_tcp,
send_tcp, &userdata, do_verbose?logfile:0);