...
If realloc()
is called with size
equal to 0, then if a NULL null pointer is returned, the old value should be unchanged. However, there are some common but non-conforming implementations that free the pointer , which including:
- Glibc (GNU/Linux)
- AIX
- HP-UX
- Solaris
- OSF/1
This means that 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.
...