summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-11-14 00:39:35 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-11-14 00:39:35 (GMT)
commit507eabdf11d34cd95cbe44ba876af0a414d7f597 (patch)
tree067a5b98be408e8e11b235b8074b633a4b0c9c31 /Objects/exceptions.c
parent2bcae708d8775f40a0c9b18eb28cb60b54f6cdc3 (diff)
downloadcpython-507eabdf11d34cd95cbe44ba876af0a414d7f597.zip
cpython-507eabdf11d34cd95cbe44ba876af0a414d7f597.tar.gz
cpython-507eabdf11d34cd95cbe44ba876af0a414d7f597.tar.bz2
Issue #17828: va_start() must be accompanied by va_end()
CID 1128793: Missing varargs init or cleanup (VARARGS)
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 53d8b66..2f0d5b6 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -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;