1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-08 23:58:24 +00:00

Fix a few memory leaks

This commit is contained in:
Rosen Penev 2017-11-04 23:20:36 -07:00
parent 127deee8ed
commit 51a5e1cc51

View File

@ -76,6 +76,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1) if (rc == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict);
@ -83,8 +85,6 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
fclose (fd);
if (status_ctx->words_cnt == 0) if (status_ctx->words_cnt == 0)
{ {
logfile_sub_msg ("STOP"); logfile_sub_msg ("STOP");
@ -111,14 +111,14 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict1, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict1, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1) if (rc == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict1); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict1);
return -1; return -1;
} }
fclose (fd);
} }
else if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_RIGHT) else if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{ {
@ -133,14 +133,14 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict2, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict2, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1) if (rc == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict2); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict2);
return -1; return -1;
} }
fclose (fd);
} }
if (status_ctx->words_cnt == 0) if (status_ctx->words_cnt == 0)
@ -179,6 +179,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1) if (rc == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict);
@ -186,8 +188,6 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
fclose (fd);
if (status_ctx->words_cnt == 0) if (status_ctx->words_cnt == 0)
{ {
logfile_sub_msg ("STOP"); logfile_sub_msg ("STOP");