mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
stratum: attempt to reduce memory leaks
This commit is contained in:
parent
31e908531a
commit
fa47829c4e
3 changed files with 10 additions and 4 deletions
|
@ -115,7 +115,6 @@ YAAMP_JOB_TEMPLATE *coind_create_template(YAAMP_COIND *coind)
|
|||
{
|
||||
coind_error(coind, "getblocktemplate result");
|
||||
json_value_free(json);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -124,7 +123,6 @@ YAAMP_JOB_TEMPLATE *coind_create_template(YAAMP_COIND *coind)
|
|||
{
|
||||
coind_error(coind, "getblocktemplate transactions");
|
||||
json_value_free(json);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -133,7 +131,6 @@ YAAMP_JOB_TEMPLATE *coind_create_template(YAAMP_COIND *coind)
|
|||
{
|
||||
coind_error(coind, "getblocktemplate coinbaseaux");
|
||||
json_value_free(json);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -204,6 +201,7 @@ YAAMP_JOB_TEMPLATE *coind_create_template(YAAMP_COIND *coind)
|
|||
templ->txmerkles[0] = 0;
|
||||
templ->txcount = txhashes.size();
|
||||
templ->txsteps = merkle_steps(txhashes);
|
||||
txhashes.clear();
|
||||
|
||||
vector<string>::const_iterator i;
|
||||
for(i = templ->txsteps.begin(); i != templ->txsteps.end(); ++i)
|
||||
|
@ -251,6 +249,10 @@ void coind_create_job(YAAMP_COIND *coind, bool force)
|
|||
strcmp(templ->coinb2, job_last->templ->coinb2) == 0)
|
||||
{
|
||||
// debuglog("coind_create_job %s %d same template %x \n", coind->name, coind->height, coind->job->id);
|
||||
if (templ->txcount) {
|
||||
templ->txsteps.clear();
|
||||
templ->txdata.clear();
|
||||
}
|
||||
delete templ;
|
||||
|
||||
CommonUnlock(&coind->mutex);
|
||||
|
|
|
@ -73,6 +73,10 @@ public:
|
|||
inline void job_delete(YAAMP_OBJECT *object)
|
||||
{
|
||||
YAAMP_JOB *job = (YAAMP_JOB *)object;
|
||||
if (job->templ->txcount) {
|
||||
job->templ->txsteps.clear();
|
||||
job->templ->txdata.clear();
|
||||
}
|
||||
delete job->templ;
|
||||
delete job;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue