Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 507eabd

Browse files
committed
Issue #17828: va_start() must be accompanied by va_end()
CID 1128793: Missing varargs init or cleanup (VARARGS)
1 parent 2bcae70 commit 507eabd

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Objects/exceptions.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,12 +2632,6 @@ _PyErr_TrySetFromCause(const char *format, ...)
26322632
PyObject *new_exc, *new_val, *new_tb;
26332633
va_list vargs;
26342634

2635-
#ifdef HAVE_STDARG_PROTOTYPES
2636-
va_start(vargs, format);
2637-
#else
2638-
va_start(vargs);
2639-
#endif
2640-
26412635
PyErr_Fetch(&exc, &val, &tb);
26422636
caught_type = (PyTypeObject *) exc;
26432637
/* Ensure type info indicates no extra state is stored at the C level */
@@ -2690,7 +2684,14 @@ _PyErr_TrySetFromCause(const char *format, ...)
26902684
* types as well, but that's quite a bit trickier due to the extra
26912685
* state potentially stored on OSError instances.
26922686
*/
2687+
2688+
#ifdef HAVE_STDARG_PROTOTYPES
2689+
va_start(vargs, format);
2690+
#else
2691+
va_start(vargs);
2692+
#endif
26932693
msg_prefix = PyUnicode_FromFormatV(format, vargs);
2694+
va_end(vargs);
26942695
if (msg_prefix == NULL)
26952696
return NULL;
26962697

0 commit comments

Comments
 (0)