Browse Source

Fix memory leak in node_msg_type

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

13
src/stratifier.c

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

Loading…
Cancel
Save