The new function wraps, realloc() and if the realloc() fails, it free()s the old pointer. This is an improvement on the potential realloc() memory leak that was fixed in 15a9062609. Still needs fuzzing to validate it.
15a9062609