Add missing check of PyDict_SetItem()'s return value

CID 486659
This commit is contained in:
Christian Heimes 2013-07-20 15:01:26 +02:00
parent 26532f7519
commit 97cb67b9ca
1 changed files with 4 additions and 1 deletions

View File

@ -120,7 +120,10 @@ test_dict_inner(int count)
for (i = 0; i < count; i++) {
v = PyLong_FromLong(i);
PyDict_SetItem(dict, v, v);
if (PyDict_SetItem(dict, v, v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);
}