summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 13:01:26 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 13:01:26 (GMT)
commit97cb67b9ca1d3e36dcaabb3879380c01820e16a6 (patch)
tree7f70337b8c89b01e45fcd25703819e877f405113
parent26532f7519b9b7764dd046acab49d5fc5dbcd94d (diff)
downloadcpython-97cb67b9ca1d3e36dcaabb3879380c01820e16a6.zip
cpython-97cb67b9ca1d3e36dcaabb3879380c01820e16a6.tar.gz
cpython-97cb67b9ca1d3e36dcaabb3879380c01820e16a6.tar.bz2
Add missing check of PyDict_SetItem()'s return value
CID 486659
-rw-r--r--Modules/_testcapimodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 2f43813..ab10faa 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -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);
}