mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
Fix some memory leaks at shutdown
This commit is contained in:
parent
0a330d4335
commit
1c9aa25886
@ -253,6 +253,8 @@ int user_options_sanity (user_options_t *user_options, int myargc, char **myargv
|
||||
|
||||
int user_options_extra_init (user_options_t *user_options, int myargc, char **myargv, user_options_extra_t *user_options_extra);
|
||||
|
||||
void user_options_extra_destroy (user_options_extra_t *user_options_extra);
|
||||
|
||||
void user_options_logger (const user_options_t *user_options, const logfile_ctx_t *logfile_ctx);
|
||||
|
||||
#endif // _USER_OPTIONS_H
|
||||
|
@ -307,20 +307,6 @@ int main (int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* logfile init
|
||||
*/
|
||||
|
||||
logfile_ctx_t *logfile_ctx = (logfile_ctx_t *) mymalloc (sizeof (logfile_ctx_t));
|
||||
|
||||
data.logfile_ctx = logfile_ctx;
|
||||
|
||||
logfile_init (logfile_ctx, user_options, folder_config);
|
||||
|
||||
logfile_generate_topid (logfile_ctx);
|
||||
|
||||
logfile_top_msg ("START");
|
||||
|
||||
/**
|
||||
* process user input
|
||||
*/
|
||||
@ -337,6 +323,20 @@ int main (int argc, char **argv)
|
||||
|
||||
if (rc_user_options_sanity == -1) return -1;
|
||||
|
||||
/**
|
||||
* logfile init
|
||||
*/
|
||||
|
||||
logfile_ctx_t *logfile_ctx = (logfile_ctx_t *) mymalloc (sizeof (logfile_ctx_t));
|
||||
|
||||
data.logfile_ctx = logfile_ctx;
|
||||
|
||||
logfile_init (logfile_ctx, user_options, folder_config);
|
||||
|
||||
logfile_generate_topid (logfile_ctx);
|
||||
|
||||
logfile_top_msg ("START");
|
||||
|
||||
user_options_logger (user_options, logfile_ctx);
|
||||
|
||||
/**
|
||||
@ -3724,27 +3724,19 @@ int main (int argc, char **argv)
|
||||
|
||||
// free memory
|
||||
|
||||
local_free (hashconfig);
|
||||
|
||||
local_free (eff_restore_file);
|
||||
local_free (new_restore_file);
|
||||
|
||||
local_free (rd);
|
||||
|
||||
// tuning db
|
||||
hashconfig_destroy (hashconfig);
|
||||
|
||||
tuning_db_destroy (tuning_db);
|
||||
|
||||
// induction directory
|
||||
|
||||
induct_ctx_destroy (induct_ctx);
|
||||
|
||||
// outfile-check directory
|
||||
|
||||
outcheck_ctx_destroy (outcheck_ctx);
|
||||
|
||||
// shutdown
|
||||
|
||||
time_t proc_stop;
|
||||
|
||||
time (&proc_stop);
|
||||
@ -3756,6 +3748,8 @@ int main (int argc, char **argv)
|
||||
|
||||
logfile_destroy (logfile_ctx);
|
||||
|
||||
// shutdown
|
||||
|
||||
if (user_options->quiet == false) log_info_nn ("Started: %s", ctime (&proc_start));
|
||||
if (user_options->quiet == false) log_info_nn ("Stopped: %s", ctime (&proc_stop));
|
||||
|
||||
@ -3770,5 +3764,9 @@ int main (int argc, char **argv)
|
||||
|
||||
folder_config_destroy (folder_config);
|
||||
|
||||
user_options_extra_destroy (user_options_extra);
|
||||
|
||||
user_options_destroy (user_options);
|
||||
|
||||
return rc_final;
|
||||
}
|
||||
|
@ -874,6 +874,11 @@ int user_options_extra_init (user_options_t *user_options, int myargc, char **my
|
||||
return 0;
|
||||
}
|
||||
|
||||
void user_options_extra_destroy (user_options_extra_t *user_options_extra)
|
||||
{
|
||||
myfree (user_options_extra);
|
||||
}
|
||||
|
||||
void user_options_logger (const user_options_t *user_options, const logfile_ctx_t *logfile_ctx)
|
||||
{
|
||||
logfile_top_uint (user_options->benchmark);
|
||||
|
Loading…
Reference in New Issue
Block a user