Browse Source

Don't bother NULLing automatic json params variables at end of functions

master
ckolivas 10 years ago
parent
commit
b69037680d
  1. 17
      src/stratifier.c

17
src/stratifier.c

@ -3486,13 +3486,12 @@ static void ssend_process(ckpool_t *ckp, smsg_t *msg)
free_smsg(msg); free_smsg(msg);
} }
static void discard_json_params(json_params_t **jp) static void discard_json_params(json_params_t *jp)
{ {
json_decref((*jp)->method); json_decref(jp->method);
json_decref((*jp)->params); json_decref(jp->params);
json_decref((*jp)->id_val); json_decref(jp->id_val);
free(*jp); free(jp);
*jp = NULL;
} }
static void sshare_process(ckpool_t *ckp, json_params_t *jp) static void sshare_process(ckpool_t *ckp, json_params_t *jp)
@ -3522,7 +3521,7 @@ static void sshare_process(ckpool_t *ckp, json_params_t *jp)
out_decref: out_decref:
dec_instance_ref(sdata, client); dec_instance_ref(sdata, client);
out: out:
discard_json_params(&jp); discard_json_params(jp);
} }
static void sauth_process(ckpool_t *ckp, json_params_t *jp) static void sauth_process(ckpool_t *ckp, json_params_t *jp)
@ -3574,7 +3573,7 @@ static void sauth_process(ckpool_t *ckp, json_params_t *jp)
out: out:
if (client) if (client)
dec_instance_ref(sdata, client); dec_instance_ref(sdata, client);
discard_json_params(&jp); discard_json_params(jp);
} }
@ -3768,9 +3767,9 @@ static void send_transactions(ckpool_t *ckp, json_params_t *jp)
out_send: out_send:
stratum_add_send(sdata, val, jp->client_id); stratum_add_send(sdata, val, jp->client_id);
out: out:
discard_json_params(&jp);
if (client) if (client)
dec_instance_ref(sdata, client); dec_instance_ref(sdata, client);
discard_json_params(jp);
} }
/* Called 32 times per min, we send the updated stats to ckdb of those users /* Called 32 times per min, we send the updated stats to ckdb of those users

Loading…
Cancel
Save