Avoid a memory leak if vfprintf(3) by always calling va_end(3); this
authorHiten Pandya <hmp@dragonflybsd.org>
Mon, 7 Jun 2004 17:59:42 +0000 (17:59 +0000)
committerHiten Pandya <hmp@dragonflybsd.org>
Mon, 7 Jun 2004 17:59:42 +0000 (17:59 +0000)
commita71425d5d9795e2139fa719ca79df904c9ea6bd8
tree5a73c48feac4366b8216616ac2fbf4b2f4999098
parent6822bd2edc1e1771304a97491c6ca36f9d80c32a
Avoid a memory leak if vfprintf(3) by always calling va_end(3); this
happens if vfprintf(3) runs out of memory.

Move the va_start(3) closer to the vfprintf(3) call; free the buffer
when if there is a failure condition and don't bother to realloc the
buffer before returning it.

Work done by Bruce Evans and Tim J. Robbins of the FreeBSD Project.
lib/libc/stdio/asprintf.c