argon2: don't dereference a pointer before testing it for NULL
This commit is contained in:
parent
77a61b8ad7
commit
28ca446f73
@ -109,7 +109,7 @@ void fill_segment_ref(const argon2_instance_t *instance,
|
||||
uint32_t prev_offset, curr_offset;
|
||||
uint32_t starting_index;
|
||||
uint32_t i;
|
||||
int data_independent_addressing = (instance->type == Argon2_i);
|
||||
int data_independent_addressing;
|
||||
/* Pseudo-random values that determine the reference block position */
|
||||
uint64_t *pseudo_rands = NULL;
|
||||
|
||||
@ -117,6 +117,8 @@ void fill_segment_ref(const argon2_instance_t *instance,
|
||||
return;
|
||||
}
|
||||
|
||||
data_independent_addressing = (instance->type == Argon2_i);
|
||||
|
||||
pseudo_rands =
|
||||
(uint64_t *)malloc(sizeof(uint64_t) * (instance->segment_length));
|
||||
|
||||
|
@ -101,7 +101,7 @@ void fill_segment_ssse3(const argon2_instance_t *instance,
|
||||
uint32_t prev_offset, curr_offset;
|
||||
uint32_t starting_index, i;
|
||||
__m128i state[64];
|
||||
int data_independent_addressing = (instance->type == Argon2_i);
|
||||
int data_independent_addressing;
|
||||
|
||||
/* Pseudo-random values that determine the reference block position */
|
||||
uint64_t *pseudo_rands = NULL;
|
||||
@ -110,6 +110,8 @@ void fill_segment_ssse3(const argon2_instance_t *instance,
|
||||
return;
|
||||
}
|
||||
|
||||
data_independent_addressing = (instance->type == Argon2_i);
|
||||
|
||||
pseudo_rands =
|
||||
(uint64_t *)malloc(sizeof(uint64_t) * instance->segment_length);
|
||||
if (pseudo_rands == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user