1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-27 06:54:36 +00:00

Check for calloc failure for completeness in gen_stratum_work.

This commit is contained in:
Con Kolivas 2013-02-04 11:22:08 +11:00
parent d644fdf1f4
commit 81025611ac

View File

@ -5099,6 +5099,8 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
alloc_len = pool->swork.cb_len;
align_len(&alloc_len);
coinbase = calloc(alloc_len, 1);
if (unlikely(!coinbase))
quit(1, "Failed to calloc coinbase in gen_stratum_work");
hex2bin(coinbase, pool->swork.coinbase1, pool->swork.cb1_len);
hex2bin(coinbase + pool->swork.cb1_len, pool->nonce1, pool->n1_len);
hex2bin(coinbase + pool->swork.cb1_len + pool->n1_len, work->nonce2, pool->n2size);
@ -5123,6 +5125,8 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
merkle_hash = bin2hex((const unsigned char *)merkle_root, 32);
header = calloc(pool->swork.header_len, 1);
if (unlikely(!header))
quit(1, "Failed to calloc header in gen_stratum_work");
sprintf(header, "%s%s%s%s%s%s%s",
pool->swork.bbversion,
pool->swork.prev_hash,