summaryrefslogtreecommitdiffstats
path: root/Python
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
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')
-rw-r--r--Python/getargs.c14
-rw-r--r--Python/modsupport.c14
2 files changed, 21 insertions, 7 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index cd80eda..43656eb 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -141,20 +141,26 @@ int
PyArg_VaParse(PyObject *args, const char *format, va_list va)
{
va_list lva;
+ int retval;
va_copy(lva, va);
- return vgetargs1(args, format, &lva, 0);
+ retval = vgetargs1(args, format, &lva, 0);
+ va_end(lva);
+ return retval;
}
int
_PyArg_VaParse_SizeT(PyObject *args, const char *format, va_list va)
{
va_list lva;
+ int retval;
va_copy(lva, va);
- return vgetargs1(args, format, &lva, FLAG_SIZE_T);
+ retval = vgetargs1(args, format, &lva, FLAG_SIZE_T);
+ va_end(lva);
+ return retval;
}
@@ -1405,6 +1411,7 @@ PyArg_VaParseTupleAndKeywords(PyObject *args,
va_copy(lva, va);
retval = vgetargskeywords(args, keywords, format, kwlist, &lva, 0);
+ va_end(lva);
return retval;
}
@@ -1430,6 +1437,7 @@ _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *args,
retval = vgetargskeywords(args, keywords, format,
kwlist, &lva, FLAG_SIZE_T);
+ va_end(lva);
return retval;
}
@@ -1534,6 +1542,7 @@ _PyArg_VaParseTupleAndKeywordsFast(PyObject *args, PyObject *keywords,
va_copy(lva, va);
retval = vgetargskeywordsfast(args, keywords, parser, &lva, 0);
+ va_end(lva);
return retval;
}
@@ -1555,6 +1564,7 @@ _PyArg_VaParseTupleAndKeywordsFast_SizeT(PyObject *args, PyObject *keywords,
va_copy(lva, va);
retval = vgetargskeywordsfast(args, keywords, parser, &lva, FLAG_SIZE_T);
+ va_end(lva);
return retval;
}
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;
}