mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-16 15:57:39 +00:00
JSONRPCRequest: fixed undefined behavior in the error handler
This commit is contained in:
parent
5dd8d11b72
commit
07cfb54bdc
1 changed files with 3 additions and 2 deletions
|
@ -36,10 +36,11 @@ public:
|
|||
static FORCEINLINE void call(const char* address, int port, const char* req, T&& cb, U&& close_cb)
|
||||
{
|
||||
// It will be deleted in one of the tcp callbacks eventually
|
||||
JSONRPCRequest* r = new JSONRPCRequest(address, port, req, new Callback<T>(std::move(cb)), new Callback<U>(std::move(close_cb)));
|
||||
CallbackBase* close_callback = new Callback<U>(std::move(close_cb));
|
||||
JSONRPCRequest* r = new JSONRPCRequest(address, port, req, new Callback<T>(std::move(cb)), close_callback);
|
||||
if (!r->m_valid) {
|
||||
constexpr char err[] = "internal error";
|
||||
close_cb(err, sizeof(err) - 1);
|
||||
(*close_callback)(err, sizeof(err) - 1);
|
||||
delete r;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue