lib/vasprintf: Shouldn't call va_end(ap) to avoid the double free
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
805f40f2f9
commit
82813472d1
|
@ -93,7 +93,6 @@ int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap)
|
||||||
buf = (FAR char *)lib_malloc(nulloutstream.nput + 1);
|
buf = (FAR char *)lib_malloc(nulloutstream.nput + 1);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
va_end(ap);
|
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
va_end(ap2);
|
va_end(ap2);
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,8 +118,6 @@ int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap)
|
||||||
fmt, ap);
|
fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
/* Return a pointer to the string to the caller. NOTE: the memstream put()
|
/* Return a pointer to the string to the caller. NOTE: the memstream put()
|
||||||
* method has already added the NUL terminator to the end of the string
|
* method has already added the NUL terminator to the end of the string
|
||||||
* (not included in the nput count).
|
* (not included in the nput count).
|
||||||
|
|
Loading…
Reference in New Issue