Skip to content

Commit

Permalink
Fix memory handling in Session::asyncConnect()
Browse files Browse the repository at this point in the history
`result` is allocated on the stack, don't capture its address in a
lambda.

Signed-off-by: Miklos Vajna <[email protected]>
Change-Id: I2d6dad1f76002559e400c57cd5b4ffa0b6e0f0d6
  • Loading branch information
vmiklos authored and mmeeks committed Jan 3, 2025
1 parent 4c3a229 commit 92efdeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/HttpRequest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<StreamSocket> 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);
});
};
Expand Down

0 comments on commit 92efdeb

Please sign in to comment.