This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 82813472d19485106180a282dc80eb1bd1cfd1d5
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sat Oct 9 14:20:31 2021 +0800

    lib/vasprintf: Shouldn't call va_end(ap) to avoid the double free
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 libs/libc/stdio/lib_vasprintf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libs/libc/stdio/lib_vasprintf.c b/libs/libc/stdio/lib_vasprintf.c
index 45101fd..fa93e22 100644
--- a/libs/libc/stdio/lib_vasprintf.c
+++ b/libs/libc/stdio/lib_vasprintf.c
@@ -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);
   if (!buf)
     {
-      va_end(ap);
 #ifdef va_copy
       va_end(ap2);
 #endif
@@ -119,8 +118,6 @@ int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, 
va_list ap)
                         fmt, ap);
 #endif
 
-  va_end(ap);
-
   /* 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
    * (not included in the nput count).

Reply via email to