mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Fix some memleaks on shutdown
This commit is contained in:
parent
d2877b95e4
commit
af1701c765
@ -141,7 +141,12 @@ void bitmap_ctx_init (bitmap_ctx_t *bitmap_ctx, const user_options_t *user_optio
|
||||
|
||||
void bitmap_ctx_destroy (bitmap_ctx_t *bitmap_ctx)
|
||||
{
|
||||
if (bitmap_ctx->enabled == false) return;
|
||||
if (bitmap_ctx->enabled == false)
|
||||
{
|
||||
myfree (bitmap_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bitmap_ctx->bitmap_size = 0;
|
||||
bitmap_ctx->bitmap_mask = 0;
|
||||
|
@ -31,7 +31,12 @@ int combinator_ctx_init (combinator_ctx_t *combinator_ctx, const user_options_t
|
||||
|
||||
void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx)
|
||||
{
|
||||
if (combinator_ctx->enabled == false) return;
|
||||
if (combinator_ctx->enabled == false)
|
||||
{
|
||||
myfree (combinator_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (combinator_ctx);
|
||||
}
|
||||
|
@ -34,7 +34,12 @@ int cpt_ctx_init (cpt_ctx_t *cpt_ctx, const user_options_t *user_options)
|
||||
|
||||
void cpt_ctx_destroy (cpt_ctx_t *cpt_ctx)
|
||||
{
|
||||
if (cpt_ctx->enabled == false) return;
|
||||
if (cpt_ctx->enabled == false)
|
||||
{
|
||||
myfree (cpt_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (cpt_ctx->cpt_buf);
|
||||
|
||||
|
@ -50,11 +50,17 @@ int debugfile_init (debugfile_ctx_t *debugfile_ctx, const user_options_t *user_o
|
||||
|
||||
void debugfile_destroy (debugfile_ctx_t *debugfile_ctx)
|
||||
{
|
||||
if (debugfile_ctx->enabled == false) return;
|
||||
if (debugfile_ctx->enabled == false)
|
||||
{
|
||||
myfree (debugfile_ctx);
|
||||
|
||||
if (debugfile_ctx->filename == NULL) return;
|
||||
return;
|
||||
}
|
||||
|
||||
fclose (debugfile_ctx->fp);
|
||||
if (debugfile_ctx->filename)
|
||||
{
|
||||
fclose (debugfile_ctx->fp);
|
||||
}
|
||||
|
||||
myfree (debugfile_ctx);
|
||||
}
|
||||
|
@ -50,7 +50,12 @@ void dictstat_init (dictstat_ctx_t *dictstat_ctx, const user_options_t *user_opt
|
||||
|
||||
void dictstat_destroy (dictstat_ctx_t *dictstat_ctx)
|
||||
{
|
||||
if (dictstat_ctx->enabled == false) return;
|
||||
if (dictstat_ctx->enabled == false)
|
||||
{
|
||||
myfree (dictstat_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (dictstat_ctx->filename);
|
||||
myfree (dictstat_ctx->base);
|
||||
|
@ -409,12 +409,16 @@ int folder_config_init (folder_config_t *folder_config, const char *install_fold
|
||||
|
||||
void folder_config_destroy (folder_config_t *folder_config)
|
||||
{
|
||||
myfree (folder_config->cpath_real);
|
||||
myfree (folder_config->cwd);
|
||||
myfree (folder_config->install_dir);
|
||||
|
||||
folder_config->cpath_real = NULL;
|
||||
folder_config->cwd = NULL;
|
||||
folder_config->install_dir = NULL;
|
||||
folder_config->profile_dir = NULL;
|
||||
folder_config->session_dir = NULL;
|
||||
folder_config->shared_dir = NULL;
|
||||
folder_config->cpath_real = NULL;
|
||||
|
||||
myfree (folder_config);
|
||||
}
|
||||
|
@ -1525,6 +1525,8 @@ void hashes_destroy (hashes_t *hashes)
|
||||
hashes->hashes_buf = NULL;
|
||||
|
||||
hashes->hash_info = NULL;
|
||||
|
||||
myfree (hashes);
|
||||
}
|
||||
|
||||
void hashes_logger (const hashes_t *hashes, const logfile_ctx_t *logfile_ctx)
|
||||
|
@ -1269,7 +1269,12 @@ int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options,
|
||||
|
||||
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx)
|
||||
{
|
||||
if (hwmon_ctx->enabled == false) return;
|
||||
if (hwmon_ctx->enabled == false)
|
||||
{
|
||||
myfree (hwmon_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// reset default fan speed
|
||||
|
||||
|
@ -117,7 +117,12 @@ void induct_ctx_cleanup (induct_ctx_t *induct_ctx)
|
||||
|
||||
void induct_ctx_destroy (induct_ctx_t *induct_ctx)
|
||||
{
|
||||
if (induct_ctx->enabled == false) return;
|
||||
if (induct_ctx->enabled == false)
|
||||
{
|
||||
myfree (induct_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (rmdir (induct_ctx->root_directory) == -1)
|
||||
{
|
||||
|
@ -78,7 +78,12 @@ void logfile_init (logfile_ctx_t *logfile_ctx, const user_options_t *user_option
|
||||
|
||||
void logfile_destroy (logfile_ctx_t *logfile_ctx)
|
||||
{
|
||||
if (logfile_ctx->enabled == false) return;
|
||||
if (logfile_ctx->enabled == false)
|
||||
{
|
||||
myfree (logfile_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (logfile_ctx->logfile);
|
||||
myfree (logfile_ctx->topid);
|
||||
|
@ -32,7 +32,12 @@ void loopback_init (loopback_ctx_t *loopback_ctx, const user_options_t *user_opt
|
||||
|
||||
void loopback_destroy (loopback_ctx_t *loopback_ctx)
|
||||
{
|
||||
if (loopback_ctx->enabled == false) return;
|
||||
if (loopback_ctx->enabled == false)
|
||||
{
|
||||
myfree (loopback_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (loopback_ctx->filename);
|
||||
|
||||
|
@ -1507,7 +1507,12 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_option
|
||||
|
||||
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
|
||||
{
|
||||
if (opencl_ctx->enabled == false) return;
|
||||
if (opencl_ctx->enabled == false)
|
||||
{
|
||||
myfree (opencl_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (opencl_ctx->devices_param);
|
||||
|
||||
|
@ -143,7 +143,12 @@ void potfile_init (potfile_ctx_t *potfile_ctx, const user_options_t *user_option
|
||||
|
||||
void potfile_destroy (potfile_ctx_t *potfile_ctx)
|
||||
{
|
||||
if (potfile_ctx->enabled == false) return;
|
||||
if (potfile_ctx->enabled == false)
|
||||
{
|
||||
myfree (potfile_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (potfile_ctx->filename);
|
||||
|
||||
|
@ -406,12 +406,17 @@ void restore_ctx_destroy (restore_ctx_t *restore_ctx)
|
||||
myfree (restore_ctx->eff_restore_file);
|
||||
myfree (restore_ctx->new_restore_file);
|
||||
|
||||
if (restore_ctx->enabled == false) return;
|
||||
myfree (restore_ctx->rd);
|
||||
|
||||
if (restore_ctx->enabled == false)
|
||||
{
|
||||
myfree (restore_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
restore_ctx->argc = 0;
|
||||
restore_ctx->argv = NULL;
|
||||
|
||||
myfree (restore_ctx->rd);
|
||||
|
||||
myfree (restore_ctx);
|
||||
}
|
||||
|
@ -65,7 +65,12 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
|
||||
|
||||
void straight_ctx_destroy (straight_ctx_t *straight_ctx)
|
||||
{
|
||||
if (straight_ctx->enabled == false) return;
|
||||
if (straight_ctx->enabled == false)
|
||||
{
|
||||
myfree (straight_ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (u32 dict_pos = 0; dict_pos < straight_ctx->dicts_cnt; dict_pos++)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "memory.h"
|
||||
#include "logging.h"
|
||||
#include "timer.h"
|
||||
#include "shared.h"
|
||||
#include "thread.h"
|
||||
|
||||
extern hc_global_data_t data;
|
||||
|
@ -241,7 +241,12 @@ int tuning_db_init (tuning_db_t *tuning_db, const user_options_t *user_options,
|
||||
|
||||
void tuning_db_destroy (tuning_db_t *tuning_db)
|
||||
{
|
||||
if (tuning_db->enabled == false) return;
|
||||
if (tuning_db->enabled == false)
|
||||
{
|
||||
myfree (tuning_db);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
|
@ -439,7 +439,12 @@ void wl_data_init (wl_data_t *wl_data, const user_options_t *user_options, const
|
||||
|
||||
void wl_data_destroy (wl_data_t *wl_data)
|
||||
{
|
||||
if (wl_data->enabled == false) return;
|
||||
if (wl_data->enabled == false)
|
||||
{
|
||||
myfree (wl_data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
myfree (wl_data->buf);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user