Fix access violation in hashconfig_destroy if hashcat_ctx_t is only partially initialized.

Fix hashcat_ctx leak and refactor module and kernel existence checks.
This commit is contained in:
Jukka Ojanen
2021-06-21 22:56:55 +03:00
parent 2c48bba62d
commit 6967e706c2
2 changed files with 45 additions and 49 deletions

View File

@@ -495,20 +495,21 @@ void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx)
}
}
if (hashconfig->hook_extra_param_size)
if (module_ctx->hook_extra_params)
{
const int hook_threads = (int) user_options->hook_threads;
for (int i = 0; i < hook_threads; i++)
if (hashconfig->hook_extra_param_size)
{
hcfree (module_ctx->hook_extra_params[i]);
}
const int hook_threads = (int) user_options->hook_threads;
hcfree (module_ctx->hook_extra_params);
}
else
{
hcfree (module_ctx->hook_extra_params[0]);
for (int i = 0; i < hook_threads; i++)
{
hcfree (module_ctx->hook_extra_params[i]);
}
}
else
{
hcfree (module_ctx->hook_extra_params[0]);
}
hcfree (module_ctx->hook_extra_params);
}