mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 03:59:41 +00:00
Fix memory leak.
This commit is contained in:
parent
dd7789763f
commit
39ae24b138
1 changed files with 3 additions and 4 deletions
|
@ -128,8 +128,9 @@ void xmrig::HttpClient::read(const char *data, size_t size)
|
||||||
void xmrig::HttpClient::onConnect(uv_connect_t *req, int status)
|
void xmrig::HttpClient::onConnect(uv_connect_t *req, int status)
|
||||||
{
|
{
|
||||||
auto client = static_cast<HttpClient *>(req->data);
|
auto client = static_cast<HttpClient *>(req->data);
|
||||||
|
delete req;
|
||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
delete req;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,9 +139,7 @@ void xmrig::HttpClient::onConnect(uv_connect_t *req, int status)
|
||||||
LOG_ERR("[%s:%d] connect error: \"%s\"", client->m_dns->host().data(), client->port(), uv_strerror(status));
|
LOG_ERR("[%s:%d] connect error: \"%s\"", client->m_dns->host().data(), client->port(), uv_strerror(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete req;
|
return client->close(status);
|
||||||
client->close(status);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_read_start(client->stream(), NetBuffer::onAlloc,
|
uv_read_start(client->stream(), NetBuffer::onAlloc,
|
||||||
|
|
Loading…
Reference in a new issue