Skip to content

Commit

Permalink
Armory format: Fail on some free_region_t() failures
Browse files Browse the repository at this point in the history
  • Loading branch information
solardiz committed Nov 7, 2024
1 parent 6c182c1 commit 6fd2385
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/armory_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ void reset(struct db_main *db)
return;

int i;
for (i = 0; i < max_threads; i++) {
for (i = 0; i < max_threads; i++)
free_region_t(&memory[i]);
init_region_t(&memory[i]);
}
}

static void *get_salt(char *ciphertext)
Expand Down Expand Up @@ -257,8 +255,8 @@ static int derive_keys(region_t *memory, int index, derived_key *dk)
lut_item *lut = memory->aligned;
size_t bytes_reqd = (size_t)n * sizeof(*lut);
if (!lut || memory->aligned_size < bytes_reqd) {
free_region_t(memory);
if (!(lut = alloc_region_t(memory, bytes_reqd)))
if (free_region_t(memory) ||
!(lut = alloc_region_t(memory, bytes_reqd)))
return -1;
}

Expand Down

0 comments on commit 6fd2385

Please sign in to comment.