From dcfe16eec167219ba82ae013654b923ab6512ec7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 19 Nov 2021 10:59:34 +0100 Subject: [PATCH] coolconvert: fix stack-use-after-scope The vector is allocated on the stack in a for loop, so it's not valid to refer to its address in the lambda that is executed on a thread. Rather copy it. Signed-off-by: Miklos Vajna Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508 --- tools/Tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Tool.cpp b/tools/Tool.cpp index 5d8a9ed5b2..42be6a1611 100644 --- a/tools/Tool.cpp +++ b/tools/Tool.cpp @@ -260,7 +260,7 @@ int Tool::main(const std::vector& origArgs) std::vector< std::string > files( toCopy ); std::copy( args.begin() + offset, args.begin() + offset + toCopy, files.begin() ); offset += toCopy; - clients.emplace_back([this, &files]{Worker(*this, files).run();}); + clients.emplace_back([this, files]{Worker(*this, files).run();}); } }