Skip to content

Commit a371322

Browse files
author
Mingshen Sun
committed
pypy/module/cpyext: va_end should be called before return
1 parent 3b9e3cf commit a371322

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pypy/module/cpyext/src/getargs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t m
18041804
if (!PyTuple_Check(args)) {
18051805
PyErr_SetString(PyExc_SystemError,
18061806
"PyArg_UnpackTuple() argument list is not a tuple");
1807+
va_end(vargs);
18071808
return 0;
18081809
}
18091810
l = PyTuple_GET_SIZE(args);

pypy/module/cpyext/src/varargwrapper.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ PyTuple_Pack(Py_ssize_t n, ...)
1616
for (i = 0; i < n; i++) {
1717
o = va_arg(vargs, PyObject *);
1818
Py_INCREF(o);
19-
if (PyTuple_SetItem(result, i, o) < 0)
19+
if (PyTuple_SetItem(result, i, o) < 0) {
20+
va_end(vargs);
2021
return NULL;
22+
}
2123
}
2224
va_end(vargs);
2325
return result;

0 commit comments

Comments
 (0)