From: Otto Date: Mon, 11 Jan 2021 09:03:31 +0000 (+0100) Subject: Make WebServer a unqiue poiner to avoid warning from CodeQL. X-Git-Tag: rec-4.5.0-alpha1~20^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7933b95ff913df6f35f371f55173fc96b7860cf;p=thirdparty%2Fpdns.git Make WebServer a unqiue poiner to avoid warning from CodeQL. Has the drawback that we need to include webserver.hh in the .hh file though. --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index f5baf0dc08..5588a45313 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -26,7 +26,6 @@ #include "dynlistener.hh" #include "ws-auth.hh" #include "json.hh" -#include "webserver.hh" #include "logger.hh" #include "statbag.hh" #include "misc.hh" @@ -66,7 +65,7 @@ AuthWebServer::AuthWebServer() : d_min1(0) { if(arg().mustDo("webserver") || arg().mustDo("api")) { - d_ws = new WebServer(arg()["webserver-address"], arg().asNum("webserver-port")); + d_ws = unique_ptr(new WebServer(arg()["webserver-address"], arg().asNum("webserver-port"))); d_ws->setApiKey(arg()["api-key"]); d_ws->setPassword(arg()["webserver-password"]); d_ws->setLogLevel(arg()["webserver-loglevel"]); diff --git a/pdns/ws-auth.hh b/pdns/ws-auth.hh index 8c84360974..c2b37734eb 100644 --- a/pdns/ws-auth.hh +++ b/pdns/ws-auth.hh @@ -27,6 +27,7 @@ #include #include "misc.hh" #include "namespaces.hh" +#include "webserver.hh" class Ewma { @@ -67,10 +68,6 @@ private: double d_10, d_5, d_1, d_max; }; -class WebServer; -class HttpRequest; -class HttpResponse; - class AuthWebServer { public: @@ -92,7 +89,7 @@ private: double d_min10, d_min5, d_min1; Ewma d_queries, d_cachehits, d_cachemisses; Ewma d_qcachehits, d_qcachemisses; - WebServer *d_ws{nullptr}; + unique_ptr d_ws{nullptr}; }; void apiDocs(HttpRequest* req, HttpResponse* resp);