aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/pyext
diff options
context:
space:
mode:
authorGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2011-06-07 03:38:28 +0000
committerGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2011-06-07 03:38:28 +0000
commite8e6eed0bed9db46b71fb79f8582680f8b09191a (patch)
treefe882b9b430cb87915849d5e1871971e65dcbaca /python/google/protobuf/pyext
parent7a6de0008a48507c65a01a8279e542c2e5dd982f (diff)
Fixed a memory leak in python CPP implementation.
Diffstat (limited to 'python/google/protobuf/pyext')
-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;