mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-25 17:38:23 +00:00
first pass at free'ing hashcat_status_t
This commit is contained in:
parent
f2ad095191
commit
d24a6198e8
@ -91,4 +91,6 @@ void status_progress_reset (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_status_destroy (hashcat_status_t *status_ctx);
|
||||
|
||||
#endif // _STATUS_H
|
||||
|
@ -73,4 +73,5 @@ void hcfree (void *ptr)
|
||||
if (ptr == NULL) return;
|
||||
|
||||
free (ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
|
25
src/status.c
25
src/status.c
@ -1806,3 +1806,28 @@ void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
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);
|
||||
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;
|
||||
hcfree(device_info->speed_sec_dev);
|
||||
hcfree(device_info->guess_candidates_dev);
|
||||
hcfree(device_info->hwmon_dev);
|
||||
}
|
||||
}
|
@ -692,6 +692,7 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1105,6 +1106,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1134,6 +1136,7 @@ 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));
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1178,6 +1181,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
||||
hashcat_status->speed_sec_all);
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1203,6 +1207,7 @@ 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));
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1247,6 +1252,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
|
||||
hashcat_status->speed_sec_all);
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1272,6 +1278,7 @@ 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);
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
@ -1319,5 +1326,6 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
|
||||
device_info->runtime_msec_dev);
|
||||
}
|
||||
|
||||
status_status_destroy (hashcat_status);
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user