Closes #15395: memory leaks in selectmodule.c
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 2452a65..98b3108 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -101,7 +101,7 @@
/* any intervening fileno() calls could decr this refcnt */
if (!(o = PySequence_Fast_GET_ITEM(fast_seq, i)))
- return -1;
+ goto finally;
Py_INCREF(o);
v = PyObject_AsFileDescriptor( o );
@@ -421,6 +421,7 @@
if (PyDict_GetItem(self->dict, key) == NULL) {
errno = ENOENT;
PyErr_SetFromErrno(PyExc_IOError);
+ Py_DECREF(key);
return NULL;
}
value = PyLong_FromLong(events);