summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 13:01:36 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 13:01:36 (GMT)
commit3f95bdcdbeae91648f394816888034a24153ffc5 (patch)
treeb507e177536aa5161ec0be7a55d2b6e1173c5c98 /Modules/_testcapimodule.c
parentb578735dffb37b6671473e206d5339a885367126 (diff)
parent97cb67b9ca1d3e36dcaabb3879380c01820e16a6 (diff)
downloadcpython-3f95bdcdbeae91648f394816888034a24153ffc5.zip
cpython-3f95bdcdbeae91648f394816888034a24153ffc5.tar.gz
cpython-3f95bdcdbeae91648f394816888034a24153ffc5.tar.bz2
Add missing check of PyDict_SetItem()'s return value
CID 486659
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 3eb9c24..ed234be 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);
}