summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-17 19:03:25 (GMT)
committerGeorg Brandl <georg@python.org>2006-03-17 19:03:25 (GMT)
commit5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa (patch)
tree26fd8d333d8b7fdde9e4b4bb2c39082d9a3d29d0 /Objects/typeobject.c
parenta5a0704942fcd422f817c9b34e77a2346ddcf102 (diff)
downloadcpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.zip
cpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.tar.gz
cpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.tar.bz2
Fix some missing checks after PyTuple_New, PyList_New, PyDict_New
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 65bf404..e45a480 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1106,14 +1106,17 @@ set_mro_error(PyObject *to_merge, int *remain)
char buf[1000];
PyObject *k, *v;
PyObject *set = PyDict_New();
+ if (!set) return;
to_merge_size = PyList_GET_SIZE(to_merge);
for (i = 0; i < to_merge_size; i++) {
PyObject *L = PyList_GET_ITEM(to_merge, i);
if (remain[i] < PyList_GET_SIZE(L)) {
PyObject *c = PyList_GET_ITEM(L, remain[i]);
- if (PyDict_SetItem(set, c, Py_None) < 0)
+ if (PyDict_SetItem(set, c, Py_None) < 0) {
+ Py_DECREF(set);
return;
+ }
}
}
n = PyDict_Size(set);