diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-14 10:26:55 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-14 10:26:55 +0100 |
commit | 34a8c93ce30342a01f0f5ba6b88d625c45974332 (patch) | |
tree | 7c217f2db206cba3c525b165a31bf068d80d74a1 /contrib/librdns | |
parent | 639c67dbd85d566d04c87a2f6ec59fd9b5ffe54a (diff) | |
download | rspamd-34a8c93ce30342a01f0f5ba6b88d625c45974332.tar.gz rspamd-34a8c93ce30342a01f0f5ba6b88d625c45974332.zip |
[Fix] Fix crashes when socket write errors occur
Diffstat (limited to 'contrib/librdns')
-rw-r--r-- | contrib/librdns/resolver.c | 3 | ||||
-rw-r--r-- | contrib/librdns/util.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c index ca93d7872..7fa61a391 100644 --- a/contrib/librdns/resolver.c +++ b/contrib/librdns/resolver.c @@ -402,6 +402,8 @@ rdns_process_timer (void *arg) if (!renew) { req->async->del_timer (req->async->data, req->async_event); + req->async_event = NULL; + HASH_DEL (req->io->requests, req); } /* We have not scheduled timeout actually due to send error */ @@ -480,6 +482,7 @@ rdns_process_retransmit (int fd, void *arg) resolver->async->del_write (resolver->async->data, req->async_event); + req->async_event = NULL; r = rdns_send_request (req, fd, false); diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c index aa31c96b7..b03128983 100644 --- a/contrib/librdns/util.c +++ b/contrib/librdns/util.c @@ -409,12 +409,16 @@ rdns_request_free (struct rdns_request *req) req->async_event); /* Remove from id hashes */ HASH_DEL (req->io->requests, req); + req->async_event = NULL; } else if (req->state == RDNS_REQUEST_WAIT_SEND) { /* Remove retransmit event */ req->async->del_write (req->async->data, req->async_event); + HASH_DEL (req->io->requests, req); + req->async_event = NULL; } + } #ifdef TWEETNACL if (req->curve_plugin_data != NULL) { |