diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-01-03 20:55:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-01-03 20:55:54 +0000 |
commit | 19d0e55011f75fce39c8bb8c7d733043b8a0babd (patch) | |
tree | 2480786ca5da66fae17e38ee9c9f6bed250b9bc5 /contrib | |
parent | 273bd073821c437ea22fd65ec69079e2baf45ccf (diff) | |
download | rspamd-19d0e55011f75fce39c8bb8c7d733043b8a0babd.tar.gz rspamd-19d0e55011f75fce39c8bb8c7d733043b8a0babd.zip |
[Project] Rdns: Fix TCP stuff cleanup
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/librdns/resolver.c | 1 | ||||
-rw-r--r-- | contrib/librdns/util.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c index c5cebc572..a576135db 100644 --- a/contrib/librdns/resolver.c +++ b/contrib/librdns/resolver.c @@ -817,6 +817,7 @@ rdns_process_tcp_write (int fd, struct rdns_io_channel *ioc) /* Packet has been fully written, remove it */ DL_DELETE(ioc->tcp->output_chain, oc); /* Data in output buffer belongs to request */ + REF_RELEASE(oc->req); free (oc); ioc->tcp->cur_output_chains --; } diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c index d96103bb7..b7cd99a67 100644 --- a/contrib/librdns/util.c +++ b/contrib/librdns/util.c @@ -665,6 +665,21 @@ rdns_ioc_tcp_reset (struct rdns_io_channel *ioc) } /* Clean all buffers and temporaries */ + if (ioc->tcp->cur_read_buf) { + free (ioc->tcp->cur_read_buf); + ioc->tcp->read_buf_allocated = 0; + ioc->tcp->next_read_size = 0; + ioc->tcp->cur_read = 0; + } + + struct rdns_tcp_output_chain *oc, *tmp; + DL_FOREACH_SAFE(ioc->tcp->output_chain, oc, tmp) { + REF_RELEASE(oc->req); + DL_DELETE (ioc->tcp->output_chain, oc); + free (oc); + } + + ioc->tcp->cur_output_chains = 0; ioc->flags &= ~RDNS_CHANNEL_CONNECTED; } |