Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Fix possible mem leak in initiate_stratum #746

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,8 @@ bool initiate_stratum(struct pool *pool)
if (method_val && parse_method(pool, sret)) {
free(sret);
sret = NULL;
json_decref(val);
val = NULL;
goto rereceive;
}
}
Expand Down Expand Up @@ -3339,12 +3341,17 @@ bool initiate_stratum(struct pool *pool)
cg_wlock(&pool->data_lock);
free(pool->sessionid);
free(pool->nonce1);
free(pool->nonce1bin);
pool->sessionid = pool->nonce1 = NULL;
pool->nonce1bin = NULL;
cg_wunlock(&pool->data_lock);

applog(LOG_DEBUG, "Failed to resume stratum, trying afresh");
noresume = true;
json_decref(val);
val = NULL;
free(sret);
sret = NULL;
goto resend;
}
applog(LOG_DEBUG, "Initiate stratum failed");
Expand Down