From: Otto Moerbeek Date: Mon, 24 Aug 2020 09:54:53 +0000 (+0200) Subject: Clean some coverity reported cases of exceptions thrown but not caught. X-Git-Tag: rec-4.4.0-beta1~9^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d131a1efff2c97f29d2c44d7a5a6988e5a8a50f6;p=thirdparty%2Fpdns.git Clean some coverity reported cases of exceptions thrown but not caught. See e.g. coverity report 1431930 --- 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<