79686167

Date: 2025-07-01 13:52:13
Score: 1
Natty:
Report link

realloc() is not intended to re-allocate memory of stack variables (local variables of a function). This might seem trivial but is a fruitful source of accumulating memory bugs. Hence,

uint64_t* memory = NULL;

should be a heap allocation:

uint64_t *memory = (uint64_t *) malloc(sizeof(uint64_t));
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Aiden Ghim