mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
now uses the correct realloc pattern with testing the reallocated pointer before assigning
This commit is contained in:
parent
d398576fc7
commit
51ecdeb511
1 changed files with 9 additions and 1 deletions
|
@ -562,7 +562,15 @@ void invert_hash0(uint8_t k[8]) {
|
||||||
|
|
||||||
// Create new forks by duplicating existing uint64_t values
|
// Create new forks by duplicating existing uint64_t values
|
||||||
int new_head = heads_count * 2;
|
int new_head = heads_count * 2;
|
||||||
hydra_heads = (uint64_t *)realloc(hydra_heads, new_head * sizeof(uint64_t));
|
|
||||||
|
// proper realloc pattern
|
||||||
|
uint64_t *ptmp = (uint64_t *)realloc(hydra_heads, new_head * sizeof(uint64_t));
|
||||||
|
if (ptmp == NULL) {
|
||||||
|
PrintAndLogEx(FAILED, "failed to allocate memory");
|
||||||
|
free(hydra_heads);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hydra_heads = ptmp;
|
||||||
|
|
||||||
// Duplicate all current values and add the value to both original and new ones
|
// Duplicate all current values and add the value to both original and new ones
|
||||||
for (int i = 0; i < heads_count; i++) {
|
for (int i = 0; i < heads_count; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue