Why is this an issue?
Once a block of memory has been free
d, it becomes available for other memory requests. Whether it’s re-used immediately, some time
later, or not at all is random, and may vary based on load. Because of that randomness, tests may pass when running locally, but the odds are that
such code will fail spectacularly in production by returning strange values, executing unexpected code, or causing a program crash.
Noncompliant code example
char *cp = malloc(sizeof(char)*10);
// ...
free(cp);
cp[9] = 0; // Noncompliant
Resources