]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17828: va_start() must be accompanied by va_end()
authorChristian Heimes <christian@cheimes.de>
Thu, 14 Nov 2013 00:39:35 +0000 (01:39 +0100)
committerChristian Heimes <christian@cheimes.de>
Thu, 14 Nov 2013 00:39:35 +0000 (01:39 +0100)
CID 1128793: Missing varargs init or cleanup (VARARGS)

Objects/exceptions.c

index 53d8b6668a56c06265a1ba4c6531aa51f246ac66..2f0d5b6400e60d9169e6d767f60837c9eb563685 100644 (file)
@@ -2632,12 +2632,6 @@ _PyErr_TrySetFromCause(const char *format, ...)
     PyObject *new_exc, *new_val, *new_tb;
     va_list vargs;
 
-#ifdef HAVE_STDARG_PROTOTYPES
-    va_start(vargs, format);
-#else
-    va_start(vargs);
-#endif
-
     PyErr_Fetch(&exc, &val, &tb);
     caught_type = (PyTypeObject *) exc;
     /* Ensure type info indicates no extra state is stored at the C level */
@@ -2690,7 +2684,14 @@ _PyErr_TrySetFromCause(const char *format, ...)
      * types as well, but that's quite a bit trickier due to the extra
      * state potentially stored on OSError instances.
      */
+
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, format);
+#else
+    va_start(vargs);
+#endif
     msg_prefix = PyUnicode_FromFormatV(format, vargs);
+    va_end(vargs);
     if (msg_prefix == NULL)
         return NULL;