diff --git a/cpu-miner.c b/cpu-miner.c index 7c1ee8362..154397a74 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -567,6 +567,7 @@ static bool gbt_work_decode(const json_t *val, struct work *work) goto out; } sha256d(merkle_tree[1 + i], tx, tx_size); + free(tx); if (!submit_coinbase) strcat(work->txs, tx_hex); } @@ -628,7 +629,7 @@ static bool gbt_work_decode(const json_t *val, struct work *work) if (!have_longpoll) { char *lp_uri; tmp = json_object_get(val, "longpolluri"); - lp_uri = json_is_string(tmp) ? strdup(json_string_value(tmp)) : rpc_url; + lp_uri = strdup(json_is_string(tmp) ? json_string_value(tmp) : rpc_url); have_longpoll = true; tq_push(thr_info[longpoll_thr_id].q, lp_uri); } @@ -1155,6 +1156,7 @@ static void *miner_thread(void *userdata) if (!have_stratum && (time(NULL) - g_work_time >= min_scantime || work.data[19] >= end_nonce)) { + work_free(&g_work); if (unlikely(!get_work(mythr, &g_work))) { applog(LOG_ERR, "work retrieval failed, exiting " "mining thread %d", mythr->id); @@ -1325,6 +1327,7 @@ static void *longpoll_thread(void *userdata) soval = json_object_get(res, "submitold"); submit_old = soval ? json_is_true(soval) : false; pthread_mutex_lock(&g_work_lock); + work_free(&g_work); if (have_gbt) rc = gbt_work_decode(res, &g_work); else diff --git a/winbuild-cross.sh b/winbuild-cross.sh index fac9c76dd..33257ebba 100755 --- a/winbuild-cross.sh +++ b/winbuild-cross.sh @@ -19,6 +19,7 @@ CFLAGS="-Wall -O3 -fomit-frame-pointer" mkdir release cp README.txt release/ #cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll release/ +#cp /usr/lib/gcc/i686-w64-mingw32/5.3-win32/libgcc_s_sjlj-1.dll release/ cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/ cp curl/lib/.libs/libcurl-4.dll release/ diff --git a/yescrypt.c b/yescrypt.c index 19392f99f..29bed4c2e 100644 --- a/yescrypt.c +++ b/yescrypt.c @@ -31,7 +31,7 @@ int scanhash_yescrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, do { pdata[19] = ++n; be32enc(&endiandata[19], n); - yescrypt_hash_sp((unsigned char*) &endiandata, (unsigned char*) hash64); + yescrypt_hash_sp((unsigned char*) &endiandata, perslen, (unsigned char*) hash64); if ((hash64[7] < ptarget[7]) || ((hash64[7] == ptarget[7]) && (hash64[6] < ptarget[6])) && fulltest(hash64, ptarget)) { *hashes_done = n - first_nonce + 1; diff --git a/yescrypt.h b/yescrypt.h index 8fb8b0e24..cdc2a31af 100755 --- a/yescrypt.h +++ b/yescrypt.h @@ -38,8 +38,8 @@ extern "C" { #endif -extern void yescrypt_hash_sp(const char *input, char *output); -extern void yescrypt_hash(const char *input, char *output); +extern void yescrypt_hash_sp(const char *input, int inputlen, char *output); +extern void yescrypt_hash(const char *input, int inputlen, char *output); diff --git a/yescryptcommon.c b/yescryptcommon.c index c0d09185c..f57d132fe 100755 --- a/yescryptcommon.c +++ b/yescryptcommon.c @@ -363,12 +363,12 @@ yescrypt_bsty(const uint8_t * passwd, size_t passwdlen, return retval; } -void yescrypt_hash_sp(const char *input, char *output) +void yescrypt_hash_sp(const char *input, int inputlen, char *output) { - yescrypt_bsty((const uint8_t *)input, 80, (const uint8_t *) input, 80, 2048, 8, 1, (uint8_t *)output, 32); + yescrypt_bsty((const uint8_t *)input, inputlen, (const uint8_t *) input, inputlen, 2048, 8, 1, (uint8_t *)output, 32); } -void yescrypt_hash(const char *input, char *output) +void yescrypt_hash(const char *input, int inputlen, char *output) { - yescrypt_hash_sp(input, output); + yescrypt_hash_sp(input, inputlen, output); }