mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-12 17:10:20 +03:00
fixed possible memory leak
This commit is contained in:
parent
3a229ea65c
commit
ec67f48d85
@ -1822,7 +1822,7 @@ namespace transport
|
|||||||
LogPrint(eLogError, "NTCP2: HTTP proxy write error ", ec.message());
|
LogPrint(eLogError, "NTCP2: HTTP proxy write error ", ec.message());
|
||||||
});
|
});
|
||||||
|
|
||||||
boost::asio::streambuf * readbuff = new boost::asio::streambuf;
|
auto readbuff = std::make_shared<boost::asio::streambuf>();
|
||||||
boost::asio::async_read_until(conn->GetSocket(), *readbuff, "\r\n\r\n",
|
boost::asio::async_read_until(conn->GetSocket(), *readbuff, "\r\n\r\n",
|
||||||
[readbuff, timer, conn] (const boost::system::error_code & ec, std::size_t transferred)
|
[readbuff, timer, conn] (const boost::system::error_code & ec, std::size_t transferred)
|
||||||
{
|
{
|
||||||
@ -1842,7 +1842,6 @@ namespace transport
|
|||||||
{
|
{
|
||||||
timer->cancel();
|
timer->cancel();
|
||||||
conn->ClientLogin();
|
conn->ClientLogin();
|
||||||
delete readbuff;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1852,7 +1851,6 @@ namespace transport
|
|||||||
LogPrint(eLogError, "NTCP2: HTTP proxy gave malformed response");
|
LogPrint(eLogError, "NTCP2: HTTP proxy gave malformed response");
|
||||||
timer->cancel();
|
timer->cancel();
|
||||||
conn->Terminate();
|
conn->Terminate();
|
||||||
delete readbuff;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user