From d131a1efff2c97f29d2c44d7a5a6988e5a8a50f6 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 24 Aug 2020 11:54:53 +0200 Subject: [PATCH] Clean some coverity reported cases of exceptions thrown but not caught. See e.g. coverity report 1431930 --- pdns/rec_channel_rec.cc | 85 ++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index b692e07645..5c76712a79 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -435,9 +435,14 @@ static string doWipeCache(T begin, T end, uint16_t qtype) int count=0, pcount=0, countNeg=0; for (auto wipe : toWipe) { - count+= broadcastAccFunction([=]{ return pleaseWipeCache(wipe.first, wipe.second, qtype);}); - pcount+= broadcastAccFunction([=]{ return pleaseWipePacketCache(wipe.first, wipe.second, qtype);}); - countNeg+=broadcastAccFunction([=]{ return pleaseWipeAndCountNegCache(wipe.first, wipe.second);}); + try { + count+= broadcastAccFunction([=]{ return pleaseWipeCache(wipe.first, wipe.second, qtype);}); + pcount+= broadcastAccFunction([=]{ return pleaseWipePacketCache(wipe.first, wipe.second, qtype);}); + countNeg+=broadcastAccFunction([=]{ return pleaseWipeAndCountNegCache(wipe.first, wipe.second);}); + } + catch (const std::exception& e) { + g_log<([=]{return pleaseWipeCache(who, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipePacketCache(who, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(who, true);}); + try { + broadcastAccFunction([=]{return pleaseWipeCache(who, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipePacketCache(who, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(who, true);}); + } + catch (std::exception& e) { + g_log<([=]{return pleaseWipeCache(entry, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipePacketCache(entry, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(entry, true);}); - if (!first) { - first = false; - removed += ","; + try { + for (auto const &entry : toRemove) { + g_log<([=]{return pleaseWipeCache(entry, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipePacketCache(entry, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(entry, true);}); + if (!first) { + first = false; + removed += ","; + } + removed += " " + entry.toStringRootDot(); } - removed += " " + entry.toStringRootDot(); } + catch(std::exception &e) { + g_log<([=]{return pleaseWipeCache(entry, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipePacketCache(entry, true, 0xffff);}); - broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(entry, true);}); - if (!first) { - first = false; - removed += ","; + try { + for (auto const &entry : toRemove) { + g_log<([=]{return pleaseWipeCache(entry, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipePacketCache(entry, true, 0xffff);}); + broadcastAccFunction([=]{return pleaseWipeAndCountNegCache(entry, true);}); + if (!first) { + first = false; + removed += ","; + } + removed += " " + entry.toStringRootDot(); } - removed += " " + entry.toStringRootDot(); } + catch (std::exception& e) { + g_log<