1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Eventual fix for #1263

This commit is contained in:
jsteube 2017-05-30 12:15:55 +02:00
parent 2dcad3f0ee
commit 0cce17d268
4 changed files with 53 additions and 25 deletions

View File

@ -91,6 +91,6 @@ void status_progress_reset (hashcat_ctx_t *hashcat_ctx);
int status_ctx_init (hashcat_ctx_t *hashcat_ctx); int status_ctx_init (hashcat_ctx_t *hashcat_ctx);
void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx); void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
void status_status_destroy (hashcat_status_t *status_ctx); void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *status_ctx);
#endif // _STATUS_H #endif // _STATUS_H

View File

@ -73,5 +73,4 @@ void hcfree (void *ptr)
if (ptr == NULL) return; if (ptr == NULL) return;
free (ptr); free (ptr);
ptr = NULL;
} }

View File

@ -1807,26 +1807,47 @@ void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
memset (status_ctx, 0, sizeof (status_ctx_t)); memset (status_ctx, 0, sizeof (status_ctx_t));
} }
void status_status_destroy (hashcat_status_t *status_ctx)
{
if (NULL == status_ctx) return;
hcfree (status_ctx->session); void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_status)
hcfree (status_ctx->time_estimated_absolute);
hcfree (status_ctx->time_estimated_relative);
hcfree (status_ctx->time_started_absolute);
hcfree (status_ctx->time_started_relative);
hcfree (status_ctx->speed_sec_all);
hcfree (status_ctx->guess_base);
hcfree (status_ctx->guess_mod);
hcfree (status_ctx->guess_charset);
hcfree (status_ctx->cpt);
for (int device_id = 0; device_id < status_ctx->device_info_cnt; device_id++)
{ {
device_info_t *device_info = status_ctx->device_info_buf + device_id; const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
if (status_ctx == NULL) return;
if (status_ctx->accessible == false) return;
hcfree (hashcat_status->session);
hcfree (hashcat_status->time_estimated_absolute);
hcfree (hashcat_status->time_estimated_relative);
hcfree (hashcat_status->time_started_absolute);
hcfree (hashcat_status->time_started_relative);
hcfree (hashcat_status->speed_sec_all);
hcfree (hashcat_status->guess_base);
hcfree (hashcat_status->guess_mod);
hcfree (hashcat_status->guess_charset);
hcfree (hashcat_status->cpt);
hashcat_status->session = NULL;
hashcat_status->time_estimated_absolute = NULL;
hashcat_status->time_estimated_relative = NULL;
hashcat_status->time_started_absolute = NULL;
hashcat_status->time_started_relative = NULL;
hashcat_status->speed_sec_all = NULL;
hashcat_status->guess_base = NULL;
hashcat_status->guess_mod = NULL;
hashcat_status->guess_charset = NULL;
hashcat_status->cpt = NULL;
for (int device_id = 0; device_id < hashcat_status->device_info_cnt; device_id++)
{
device_info_t *device_info = hashcat_status->device_info_buf + device_id;
hcfree (device_info->speed_sec_dev); hcfree (device_info->speed_sec_dev);
hcfree (device_info->guess_candidates_dev); hcfree (device_info->guess_candidates_dev);
hcfree (device_info->hwmon_dev); hcfree (device_info->hwmon_dev);
device_info->speed_sec_dev = NULL;
device_info->guess_candidates_dev = NULL;
device_info->hwmon_dev = NULL;
} }
} }

View File

@ -692,7 +692,8 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
fflush (stdout); fflush (stdout);
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1106,7 +1107,8 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
} }
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1136,7 +1138,8 @@ void status_benchmark_machine_readable (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "%d:%u:%d:%d:%.2f:%" PRIu64, device_id + 1, hash_mode, device_info->corespeed_dev, device_info->memoryspeed_dev, device_info->exec_msec_dev, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); event_log_info (hashcat_ctx, "%d:%u:%d:%d:%.2f:%" PRIu64, device_id + 1, hash_mode, device_info->corespeed_dev, device_info->memoryspeed_dev, device_info->exec_msec_dev, (u64) (device_info->hashes_msec_dev_benchmark * 1000));
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1181,7 +1184,8 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
hashcat_status->speed_sec_all); hashcat_status->speed_sec_all);
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1207,7 +1211,8 @@ void status_speed_machine_readable (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "%d:%" PRIu64, device_id + 1, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); event_log_info (hashcat_ctx, "%d:%" PRIu64, device_id + 1, (u64) (device_info->hashes_msec_dev_benchmark * 1000));
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1252,7 +1257,8 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
hashcat_status->speed_sec_all); hashcat_status->speed_sec_all);
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1278,7 +1284,8 @@ void status_progress_machine_readable (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "%d:%d:%0.2f", device_id + 1, device_info->progress_dev, device_info->runtime_msec_dev); event_log_info (hashcat_ctx, "%d:%d:%0.2f", device_id + 1, device_info->progress_dev, device_info->runtime_msec_dev);
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }
@ -1326,6 +1333,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
device_info->runtime_msec_dev); device_info->runtime_msec_dev);
} }
status_status_destroy (hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status); hcfree (hashcat_status);
} }