Merge pull request #573 from h4waii/patch-3

fix: #520 - free mutex after work is done
This commit is contained in:
Iceman 2020-02-24 15:00:17 +01:00 committed by GitHub
commit fc84a285ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1845,14 +1845,15 @@ static bool TestIfKeyExists(uint64_t key) {
num_keys_tested += count;
hardnested_print_progress(num_acquired_nonces, "(Test: Key found)", 0.0, 0);
crypto1_destroy(pcs);
pthread_mutex_destroy(&statelist_cache_mutex);
return true;
}
}
num_keys_tested += count;
hardnested_print_progress(num_acquired_nonces, "(Test: Key NOT found)", 0.0, 0);
crypto1_destroy(pcs);
pthread_mutex_destroy(&statelist_cache_mutex);
return false;
}
@ -2042,9 +2043,6 @@ static void generate_candidates(uint8_t sum_a0_idx, uint8_t sum_a8_idx) {
pthread_join(thread_id[i], NULL);
}
// clean up mutex
pthread_mutex_destroy(&statelist_cache_mutex);
maximum_states = 0;
for (statelist_t *sl = candidates; sl != NULL; sl = sl->next) {
maximum_states += (uint64_t)sl->len[ODD_STATE] * sl->len[EVEN_STATE];