From a9b0f1a559e57b8aee7b311cf2f796c4786c9645 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 14 Feb 2017 15:47:41 +0100 Subject: [PATCH] Wordlists: Fixed memory leak in case access a file in a wordlist folder fails --- docs/changes.txt | 1 + src/straight.c | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 9d8f5118d..9867f9186 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -79,6 +79,7 @@ - File Locking: Improved error detection on file locks - Sessions: Move out handling of multiple instance from restore file into separate pidfile - Threads: Restored strerror as %m is unsupported by the BSDs +- Wordlists: Fixed memory leak in case access a file in a wordlist folder fails - Wordlists: Disable dictstat handling for hash-mode 3000 as it virtually creates words in the wordlist which is not the case for other modes - WPA: Changed format for outfile and potfile from essid:mac1:mac2 to hash:essid - WPA: Changed format for outfile_check from essid:mac1:mac2 to hash diff --git a/src/straight.c b/src/straight.c index 2b44bb220..fcd17809a 100644 --- a/src/straight.c +++ b/src/straight.c @@ -288,6 +288,8 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { event_log_error (hashcat_ctx, "%s: %s", l1_filename, strerror (errno)); + hcfree (dictionary_files); + return -1; } @@ -295,7 +297,12 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { const int rc = straight_ctx_add_wl (hashcat_ctx, l1_filename); - if (rc == -1) return -1; + if (rc == -1) + { + hcfree (dictionary_files); + + return -1; + } } } } @@ -352,6 +359,8 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { event_log_error (hashcat_ctx, "%s: %s", l1_filename, strerror (errno)); + hcfree (dictionary_files); + return -1; } @@ -359,7 +368,12 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { const int rc = straight_ctx_add_wl (hashcat_ctx, l1_filename); - if (rc == -1) return -1; + if (rc == -1) + { + hcfree (dictionary_files); + + return -1; + } } } } @@ -407,6 +421,8 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { event_log_error (hashcat_ctx, "%s: %s", l1_filename, strerror (errno)); + hcfree (dictionary_files); + return -1; } @@ -414,7 +430,12 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) { const int rc = straight_ctx_add_wl (hashcat_ctx, l1_filename); - if (rc == -1) return -1; + if (rc == -1) + { + hcfree (dictionary_files); + + return -1; + } } } }