From e4970ee8859bef3c64d33e4268dca17bb8a97735 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 15 Sep 2021 10:15:52 +0200 Subject: [PATCH] dnsdist: Handle exception raised in IOStateGuard's destructor Reported by Coverity (CID 372512). --- pdns/dnsdistdist/tcpiohandler-mplexer.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/tcpiohandler-mplexer.hh b/pdns/dnsdistdist/tcpiohandler-mplexer.hh index 2fbe4b5147..d62ba7828b 100644 --- a/pdns/dnsdistdist/tcpiohandler-mplexer.hh +++ b/pdns/dnsdistdist/tcpiohandler-mplexer.hh @@ -187,7 +187,13 @@ public: and its reference count goes to zero */ if (d_enabled && d_handler) { DEBUGLOG("IOStateGuard destroyed while holding a state, let's reset it"); - d_handler->reset(); + try { + d_handler->reset(); + } + catch (const FDMultiplexerException& e) { + /* that should not happen, but an exception raised from a destructor would be bad so better + safe than sorry */ + } d_enabled = false; } } -- 2.47.2