mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Fix occasional crash when performing json rpc calls.
This commit is contained in:
parent
f20e25e0c0
commit
05355d3c79
6
util.c
6
util.c
@ -120,7 +120,7 @@ static size_t all_data_cb(const void *ptr, size_t size, size_t nmemb,
|
|||||||
size_t len = size * nmemb;
|
size_t len = size * nmemb;
|
||||||
size_t oldlen, newlen;
|
size_t oldlen, newlen;
|
||||||
void *newmem;
|
void *newmem;
|
||||||
static const unsigned char zero;
|
static const unsigned char zero = 0;
|
||||||
|
|
||||||
oldlen = db->len;
|
oldlen = db->len;
|
||||||
newlen = oldlen + len;
|
newlen = oldlen + len;
|
||||||
@ -284,6 +284,10 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
|||||||
val = JSON_LOADS(all_data.buf, &err);
|
val = JSON_LOADS(all_data.buf, &err);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text);
|
applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text);
|
||||||
|
|
||||||
|
if (opt_protocol)
|
||||||
|
applog(LOG_DEBUG, "JSON protocol response:\n%s", all_data.buf);
|
||||||
|
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user