From d1efcaae5b55aeb52aa52fae3e9f0970c3729c2c Mon Sep 17 00:00:00 2001 From: Eduard Bagdasaryan Date: Tue, 25 Sep 2018 14:42:01 +0000 Subject: [PATCH] cloneReply() "reply == NULL" assertion when denying replies (#292) 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/http/Message.h b/src/http/Message.h index 53c4bbbd6b..b11d99adf8 100644 --- a/src/http/Message.h +++ b/src/http/Message.h @@ -16,6 +16,7 @@ #include "http/ProtocolVersion.h" #include "http/StatusCode.h" #include "HttpHeader.h" +#include namespace Http { @@ -143,9 +144,11 @@ protected: } // namespace Http +template inline void -HTTPMSGUNLOCK(Http::Message *a) +HTTPMSGUNLOCK(M *&a) { + static_assert(std::is_base_of::value, "M must inherit from Http::Message"); if (a) { if (a->unlock() == 0) delete a; -- 2.47.2