]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cloneReply() "reply == NULL" assertion when denying replies (#292)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Tue, 25 Sep 2018 14:42:01 +0000 (14:42 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 26 Sep 2018 14:59:44 +0000 (14:59 +0000)
Commit e2cc8c0 lost argument nullification when converting old
HTTPMSGUNLOCK() macro into a function. This change restores that
important part of the HTTPMSGUNLOCK() API without sacrificing argument
type checks added during that conversion.

src/http/Message.h

index 53c4bbbd6b111e6f3179d069bcdf4da3c3b309e0..b11d99adf82176e9d25d7d51b71d59a7928a415d 100644 (file)
@@ -16,6 +16,7 @@
 #include "http/ProtocolVersion.h"
 #include "http/StatusCode.h"
 #include "HttpHeader.h"
+#include <type_traits>
 
 namespace Http
 {
@@ -143,9 +144,11 @@ protected:
 
 } // namespace Http
 
+template <class M>
 inline void
-HTTPMSGUNLOCK(Http::Message *a)
+HTTPMSGUNLOCK(M *&a)
 {
+    static_assert(std::is_base_of<Http::Message, M>::value, "M must inherit from Http::Message");
     if (a) {
         if (a->unlock() == 0)
             delete a;