fix: mem leaks.
This commit is contained in:
@@ -311,6 +311,11 @@ bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint
|
||||
|
||||
uint64_t start_time = msclock();
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
if ( NUM_BRUTE_FORCE_THREADS < 0 )
|
||||
return false;
|
||||
#endif
|
||||
|
||||
pthread_t threads[NUM_BRUTE_FORCE_THREADS];
|
||||
struct args {
|
||||
bool silent;
|
||||
@@ -322,7 +327,7 @@ bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint
|
||||
uint8_t *best_first_bytes;
|
||||
} thread_args[NUM_BRUTE_FORCE_THREADS];
|
||||
|
||||
for(uint32_t i = 0; i < NUM_BRUTE_FORCE_THREADS; i++){
|
||||
for (uint32_t i = 0; i < NUM_BRUTE_FORCE_THREADS; i++){
|
||||
thread_args[i].thread_ID = i;
|
||||
thread_args[i].silent = silent;
|
||||
thread_args[i].cuid = cuid;
|
||||
@@ -332,7 +337,7 @@ bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint
|
||||
thread_args[i].best_first_bytes = best_first_bytes;
|
||||
pthread_create(&threads[i], NULL, crack_states_thread, (void*)&thread_args[i]);
|
||||
}
|
||||
for(uint32_t i = 0; i < NUM_BRUTE_FORCE_THREADS; i++){
|
||||
for (uint32_t i = 0; i < NUM_BRUTE_FORCE_THREADS; i++){
|
||||
pthread_join(threads[i], 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user