commit bb00deca2c77729760e59e94b1a5202f5fb1433b
parent 1c30da855c60f12451b67fb88354dbb1d71686b9
Author: Joris Vink <joris@coders.se>
Date: Mon, 29 Oct 2018 21:18:38 +0100
don't leak op in error path
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/python.c b/src/python.c
@@ -1029,10 +1029,13 @@ python_kore_gather(PyObject *self, PyObject *args)
TAILQ_INIT(&op->coroutines);
for (idx = 0; idx < sz; idx++) {
- if ((obj = PyTuple_GetItem(args, idx)) == NULL)
+ if ((obj = PyTuple_GetItem(args, idx)) == NULL) {
+ Py_DECREF((PyObject *)op);
return (NULL);
+ }
if (!PyCoro_CheckExact(obj)) {
+ Py_DECREF((PyObject *)op);
PyErr_SetString(PyExc_TypeError, "not a coroutine");
return (NULL);
}