]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
LuaWrapper: Prevent referencing a temporary object 11482/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 29 Mar 2022 16:09:28 +0000 (18:09 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 29 Mar 2022 16:09:28 +0000 (18:09 +0200)
Reported by Coverity (CIDs 120403 and 145915)

ext/luawrapper/include/LuaContext.hpp

index e3a87ee9b77688fdaf2c9024cdcc3cb101280fad..9f8d473fb7822bacd2545a9e9c7f61400947f78a 100644 (file)
@@ -1770,7 +1770,8 @@ private:
         -> typename std::enable_if<IsOptional<TFirstType>::value, TRetValue>::type
     {
         if (index >= 0) {
-            Binder<TCallback, const TFirstType&> binder{ callback, {} };
+            static const TFirstType empty{};
+            Binder<TCallback, const TFirstType&> binder{ callback, empty };
             return readIntoFunction(state, retValueTag, binder, index + 1, othersTags...);
         }