aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/google/protobuf/pyext/python-proto2.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/google/protobuf/pyext/python-proto2.cc b/python/google/protobuf/pyext/python-proto2.cc
index f2799e62..181d7e97 100644
--- a/python/google/protobuf/pyext/python-proto2.cc
+++ b/python/google/protobuf/pyext/python-proto2.cc
@@ -1099,10 +1099,12 @@ static PyObject* CMessage_AssignRepeatedScalar(CMessage* self, PyObject* args) {
PyObject* next;
while ((next = PyIter_Next(iter)) != NULL) {
if (InternalAddRepeatedScalar(
- message, cfield_descriptor->descriptor, next) == NULL) {
+ message, cfield_descriptor->descriptor, next) == NULL) {
+ Py_DECREF(next);
Py_DECREF(iter);
return NULL;
}
+ Py_DECREF(next);
}
Py_DECREF(iter);
Py_RETURN_NONE;