summaryrefslogtreecommitdiffstats
path: root/Python/modsupport.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2016-09-21 09:37:27 (GMT)
committerChristian Heimes <christian@python.org>2016-09-21 09:37:27 (GMT)
commit2f2fee19ec63a09b184fbe09135ecb2f16a0e257 (patch)
tree7d29ab47d5691028799f81ae63215313064a8ea7 /Python/modsupport.c
parent1c56bf0bad6453e6c244ec345ad0eb4d4d1ae15c (diff)
downloadcpython-2f2fee19ec63a09b184fbe09135ecb2f16a0e257.zip
cpython-2f2fee19ec63a09b184fbe09135ecb2f16a0e257.tar.gz
cpython-2f2fee19ec63a09b184fbe09135ecb2f16a0e257.tar.bz2
va_end() all va_copy()ed va_lists.
Diffstat (limited to 'Python/modsupport.c')
-rw-r--r--Python/modsupport.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index bdaf8b2..aabee8f 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -467,8 +467,7 @@ va_build_value(const char *format, va_list va, int flags)
const char *f = format;
int n = countformat(f, '\0');
va_list lva;
-
- va_copy(lva, va);
+ PyObject *retval;
if (n < 0)
return NULL;
@@ -476,9 +475,14 @@ va_build_value(const char *format, va_list va, int flags)
Py_INCREF(Py_None);
return Py_None;
}
- if (n == 1)
- return do_mkvalue(&f, &lva, flags);
- return do_mktuple(&f, &lva, '\0', n, flags);
+ va_copy(lva, va);
+ if (n == 1) {
+ retval = do_mkvalue(&f, &lva, flags);
+ } else {
+ retval = do_mktuple(&f, &lva, '\0', n, flags);
+ }
+ va_end(lva);
+ return retval;
}