...
In nonconforming implementations, calling free
on the original pointer might result in a double-free vulnerability. However, not calling free
on the original pointer might result in a memory leak.
Compliant
...
Solution (realloc()
)
In this compliant solution, allocations of 0 bytes are prevented, ensuring that p
is freed exactly once:
...
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...