From 92efdebaeb3dae25eedb02801ac395ad6abf95dd Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 2 Jan 2025 10:26:28 +0100 Subject: [PATCH] Fix memory handling in Session::asyncConnect() `result` is allocated on the stack, don't capture its address in a lambda. Signed-off-by: Miklos Vajna Change-Id: I2d6dad1f76002559e400c57cd5b4ffa0b6e0f0d6 --- net/HttpRequest.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/HttpRequest.hpp b/net/HttpRequest.hpp index 9e67cfde512a9..fb82033de6986 100644 --- a/net/HttpRequest.hpp +++ b/net/HttpRequest.hpp @@ -1731,7 +1731,7 @@ class Session final : public ProtocolHandlerInterface _socket.reset(); // Reset to make sure we are disconnected. auto pushConnectCompleteToPoll = [this, &poll](std::shared_ptr socket, net::AsyncConnectResult result ) { - poll.addCallback([selfLifecycle = shared_from_this(), this, &poll, socket=std::move(socket), &result]() { + poll.addCallback([selfLifecycle = shared_from_this(), this, &poll, socket=std::move(socket), result]() { asyncConnectCompleted(poll, socket, result); }); };