Rev 3078: Don't leak references to the sequence object. in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/patience_tuples
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 4 17:07:58 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/patience_tuples
------------------------------------------------------------
revno: 3078
revision-id:john at arbash-meinel.com-20071204170735-1l5oc5vt7w473qds
parent: john at arbash-meinel.com-20071204162828-chfnl5ylzkh0y2ll
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: patience_tuples
timestamp: Tue 2007-12-04 11:07:35 -0600
message:
Don't leak references to the sequence object.
modified:
bzrlib/_patiencediff_c.c _patiencediff_c.c-20070721205602-q3imkipwlgagp3cy-1
-------------- next part --------------
=== modified file 'bzrlib/_patiencediff_c.c'
--- a/bzrlib/_patiencediff_c.c 2007-12-04 16:28:28 +0000
+++ b/bzrlib/_patiencediff_c.c 2007-12-04 17:07:35 +0000
@@ -583,8 +583,8 @@
subitem = PySequence_Fast_GET_ITEM(item, j);
cur_len = PyObject_Length(subitem);
if (cur_len == -1) {
- /* Error */
- return -1;
+ size = -1;
+ goto cleanup;
}
total_len += cur_len;
}
@@ -593,8 +593,8 @@
/* Generic length */
cur_len = PyObject_Length(item);
if (cur_len == -1) {
- /* Error */
- return -1;
+ size = -1;
+ goto cleanup;
}
line->len = cur_len;
}
@@ -602,12 +602,14 @@
line->hash = PyObject_Hash(item);
if (line->hash == (-1)) {
/* Propogate the hash exception */
- return -1;
+ size = -1;
+ goto cleanup;
}
line->next = SENTINEL;
line++;
}
+ cleanup:
Py_DECREF(seq);
return size;
}
More information about the bazaar-commits
mailing list