summaryrefslogtreecommitdiffstats
path: root/Modules/_abc.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-12-07 10:11:30 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-12-07 10:11:30 (GMT)
commit4c49da0cb7434c676d70b9ccf38aca82ac0d64a9 (patch)
treeaae3660f9a5bc462830107cf2311b2557898e268 /Modules/_abc.c
parent3a521f0b6167628f975c773b56c7daf8d33d6f40 (diff)
downloadcpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.zip
cpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.tar.gz
cpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.tar.bz2
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015)
Set MemoryError when appropriate, add missing failure checks, and fix some potential leaks.
Diffstat (limited to 'Modules/_abc.c')
-rw-r--r--Modules/_abc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c
index 9de199f..36c1757 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -728,6 +728,10 @@ subclasscheck_check_registry(_abc_data *impl, PyObject *subclass,
// Weakref callback may remove entry from set.
// So we take snapshot of registry first.
PyObject **copy = PyMem_Malloc(sizeof(PyObject*) * registry_size);
+ if (copy == NULL) {
+ PyErr_NoMemory();
+ return -1;
+ }
PyObject *key;
Py_ssize_t pos = 0;
Py_hash_t hash;