mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
driver-ztex: changed two pairs of malloc()/memset() to calloc()
This commit is contained in:
parent
b48b2cc8c4
commit
e59f668191
@ -222,21 +222,19 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
|
||||
|
||||
applog(LOG_DEBUG, "%s: sent hashdata", ztex->repr);
|
||||
|
||||
lastnonce = malloc(sizeof(uint32_t)*ztex->numNonces);
|
||||
lastnonce = calloc(1, sizeof(uint32_t)*ztex->numNonces);
|
||||
if (lastnonce == NULL) {
|
||||
applog(LOG_ERR, "%s: failed to allocate lastnonce[%d]", ztex->repr, ztex->numNonces);
|
||||
return -1;
|
||||
}
|
||||
memset(lastnonce, 0, sizeof(uint32_t)*ztex->numNonces);
|
||||
|
||||
/* Add an extra slot for detecting dupes that lie around */
|
||||
backlog_max = ztex->numNonces * (2 + ztex->extraSolutions);
|
||||
backlog = malloc(sizeof(uint32_t) * backlog_max);
|
||||
backlog = calloc(1, sizeof(uint32_t) * backlog_max);
|
||||
if (backlog == NULL) {
|
||||
applog(LOG_ERR, "%s: failed to allocate backlog[%d]", ztex->repr, backlog_max);
|
||||
return -1;
|
||||
}
|
||||
memset(backlog, 0, sizeof(uint32_t) * backlog_max);
|
||||
|
||||
overflow = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user