From: Remi Gacogne Date: Thu, 14 Dec 2023 15:17:48 +0000 (+0100) Subject: dnsdist: Fix Coverity warnings X-Git-Tag: auth-4.9.0-alpha1~28^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa9016863ef1ef736b22d2d4786ede6c997786cf;p=thirdparty%2Fpdns.git dnsdist: Fix Coverity warnings One real issue that impact the TCP connection termination metrics, and some insignificant "performance" warnings in places where we do not care about performance. --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index 6eb04bcbf5..4d410c96f8 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -50,7 +50,7 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck) }); /* Exceptions */ - luaCtx.registerFunction("__tostring", [](const std::exception_ptr& eptr) { + luaCtx.registerFunction("__tostring", [](const std::exception_ptr& eptr) -> std::string { try { if (eptr) { std::rethrow_exception(eptr); @@ -138,8 +138,8 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck) } s.setLazyAuto(); }); - luaCtx.registerFunction("getName", [](const DownstreamState& s) { return s.getName(); }); - luaCtx.registerFunction("getNameWithAddr", [](const DownstreamState& s) { return s.getNameWithAddr(); }); + luaCtx.registerFunction("getName", [](const DownstreamState& s) -> const std::string& { return s.getName(); }); + luaCtx.registerFunction("getNameWithAddr", [](const DownstreamState& s) -> const std::string& { return s.getNameWithAddr(); }); luaCtx.registerMember("upStatus", &DownstreamState::upStatus); luaCtx.registerMember("weight", [](const DownstreamState& s) -> int {return s.d_config.d_weight;}, diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 60e9638765..e26dd4d6de 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -2705,7 +2705,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) std::string valueStr; if (getOptionalValue(vars, "congestionControlAlgo", valueStr) > 0) { if (dnsdist::doq::s_available_cc_algorithms.count(valueStr) > 0) { - frontend->d_quicheParams.d_ccAlgo = valueStr; + frontend->d_quicheParams.d_ccAlgo = std::move(valueStr); } else { warnlog("Ignoring unknown value '%s' for 'congestionControlAlgo' on 'addDOQLocal'", valueStr);