diff --git a/src/loader.c b/src/loader.c index 4e28b22..c556704 100644 --- a/src/loader.c +++ b/src/loader.c @@ -207,23 +207,25 @@ void ldr_init_database(struct db_main *db, struct db_options *db_options) static void ldr_init_password_hash(struct db_main *db) { int (*func)(void *binary); - size_t size = PASSWORD_HASH_SIZE_FOR_LDR; + int size_num = PASSWORD_HASH_SIZE_FOR_LDR; + size_t size; - if (size >= 2 && mem_saving_level >= 2) { - size--; + if (size_num >= 2 && mem_saving_level >= 2) { + size_num--; if (mem_saving_level >= 3) - size--; + size_num--; } do { - func = db->format->methods.binary_hash[size]; + func = db->format->methods.binary_hash[size_num]; if (func && func != fmt_default_binary_hash) break; - } while (--size >= 0); - if (size < 0) - size = 0; + } while (--size_num >= 0); + if (size_num < 0) + size_num = 0; db->password_hash_func = func; - size = (size_t)password_hash_sizes[size] * sizeof(struct db_password *); + size = (size_t)password_hash_sizes[size_num] * + sizeof(struct db_password *); db->password_hash = mem_alloc(size); memset(db->password_hash, 0, size); } @@ -1436,6 +1438,7 @@ static void ldr_init_hash_for_salt(struct db_main *db, struct db_salt *salt) } hash_size = bitmap_size >> PASSWORD_HASH_SHR; + hash_alloc = 0; if (hash_size > 1) { hash_alloc = hash_size * sizeof(struct db_password *); salt->hash = mem_alloc_tiny(hash_alloc, MEM_ALIGN_WORD); @@ -1450,9 +1453,9 @@ static void ldr_init_hash_for_salt(struct db_main *db, struct db_salt *salt) goto single_threaded; #ifdef _OPENMP - #pragma omp parallel sections num_threads(3) default(none) shared(salt, bitmap_size, hash_size, hash_func, bitmap_alloc, hash_alloc) +#pragma omp parallel sections num_threads(3) default(none) shared(salt, bitmap_size, hash_size, hash_func, bitmap_alloc, hash_alloc) { - #pragma omp section +#pragma omp section { struct db_password *current; @@ -1467,7 +1470,7 @@ static void ldr_init_hash_for_salt(struct db_main *db, struct db_salt *salt) } while ((current = current->next)); } - #pragma omp section +#pragma omp section { struct db_password *current; @@ -1487,7 +1490,7 @@ static void ldr_init_hash_for_salt(struct db_main *db, struct db_salt *salt) } while ((current = current->next)); } - #pragma omp section +#pragma omp section { struct db_password *current;