From 4930105ce3c4acca35d0c8fa54bd4685eedf022d Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Tue, 4 May 2021 13:53:50 +0200 Subject: [PATCH] Fixes memleak in user_options_check_files() See https://github.com/hashcat/hashcat/pull/2669 --- src/user_options.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/user_options.c b/src/user_options.c index e81996e39..ce4d93a24 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -2824,9 +2824,13 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx) event_log_warning (hashcat_ctx, "For example, using \"7z e\" instead of using \"7z x\"."); event_log_warning (hashcat_ctx, NULL); + hcfree (modulefile); + return -1; } + hcfree (modulefile); + const bool quiet_save = user_options->quiet; user_options->quiet = true; @@ -2839,8 +2843,6 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx) hashconfig_destroy (hashcat_ctx); - hcfree (modulefile); - // same check but for an backend kernel char *kernelfile = (char *) hcmalloc (HCBUFSIZ_TINY); @@ -2855,6 +2857,8 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx) event_log_warning (hashcat_ctx, "For example, using \"7z e\" instead of using \"7z x\"."); event_log_warning (hashcat_ctx, NULL); + hcfree (kernelfile); + return -1; }