@@ -87,19 +87,25 @@ enum_next_long(enumobject *en, PyObject* next_item) |
|
|
87 |
87 |
|
88 |
88 |
if (en->en_longindex == NULL) { |
89 |
89 |
en->en_longindex = PyLong_FromSsize_t(PY_SSIZE_T_MAX); |
90 |
|
-if (en->en_longindex == NULL) |
|
90 |
+if (en->en_longindex == NULL) { |
|
91 |
+Py_DECREF(next_item); |
91 |
92 |
return NULL; |
|
93 |
+ } |
92 |
94 |
} |
93 |
95 |
if (one == NULL) { |
94 |
96 |
one = PyLong_FromLong(1); |
95 |
|
-if (one == NULL) |
|
97 |
+if (one == NULL) { |
|
98 |
+Py_DECREF(next_item); |
96 |
99 |
return NULL; |
|
100 |
+ } |
97 |
101 |
} |
98 |
102 |
next_index = en->en_longindex; |
99 |
103 |
assert(next_index != NULL); |
100 |
104 |
stepped_up = PyNumber_Add(next_index, one); |
101 |
|
-if (stepped_up == NULL) |
|
105 |
+if (stepped_up == NULL) { |
|
106 |
+Py_DECREF(next_item); |
102 |
107 |
return NULL; |
|
108 |
+ } |
103 |
109 |
en->en_longindex = stepped_up; |
104 |
110 |
|
105 |
111 |
if (result->ob_refcnt == 1) { |