mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-22 19:49:36 +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)
|
||||
{
|
||||
auto client = static_cast<HttpClient *>(req->data);
|
||||
delete req;
|
||||
|
||||
if (!client) {
|
||||
delete req;
|
||||
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));
|
||||
}
|
||||
|
||||
delete req;
|
||||
client->close(status);
|
||||
return;
|
||||
return client->close(status);
|
||||
}
|
||||
|
||||
uv_read_start(client->stream(), NetBuffer::onAlloc,
|
||||
|
|
Loading…
Reference in a new issue