Browse Source

Fix memory leak in node_msg_type

master
Con Kolivas 9 years ago
parent
commit
74bf043832
  1. 25
      src/stratifier.c

25
src/stratifier.c

@ -5807,22 +5807,24 @@ static void parse_authorise_result(ckpool_t *ckp, sdata_t *sdata, stratum_instan
static int node_msg_type(json_t *val) static int node_msg_type(json_t *val)
{ {
const char *method;
int i, ret = -1; int i, ret = -1;
char *method;
if (!val) if (!val)
goto out; goto out;
if (!json_get_string(&method, val, "node.method")) method = json_string_value(json_object_get(val, "node.method"));
goto out; if (method) {
for (i = 0; i < SM_NONE; i++) { for (i = 0; i < SM_NONE; i++) {
if (!strcmp(method, stratum_msgs[i])) { if (!strcmp(method, stratum_msgs[i])) {
ret = i; ret = i;
break; break;
}
} }
} json_object_del(val, "node.method");
json_object_del(val, "node.method"); } else
out: method = json_string_value(json_object_get(val, "method"));
if (ret < 0 && json_get_string(&method, val, "method")) {
if (ret < 0 && method) {
if (!safecmp(method, "mining.submit")) if (!safecmp(method, "mining.submit"))
ret = SM_SHARE; ret = SM_SHARE;
else if (!safecmp(method, "mining.notify")) else if (!safecmp(method, "mining.notify"))
@ -5838,6 +5840,7 @@ out:
else else
ret = SM_NONE; ret = SM_NONE;
} }
out:
return ret; return ret;
} }

Loading…
Cancel
Save