Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 38785:adacefb0b7ea stable
dirstate: use tuple interface to fix leak in pack_dirstate()
Spotted by ASAN.
Unlike PyTuple_GET_ITEM(), PySequence_ITEM() returns a new reference. This
bug could be fixed by inserting Py_CLEAR() and Py_XDECREF() appropriately,
but I think requiring a tuple object is simpler and less error-prone.
The cext version is jumped to 10 since 6..9 are used in the default branch.
We'll need to bump it again at merge.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 05 Sep 2018 20:52:22 +0900 |
parents | d5d42c170f4d |
children | 481db51c83e9 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Sep 05 22:10:41 2018 +0900 +++ b/mercurial/dirstate.py Wed Sep 05 20:52:22 2018 +0900 @@ -1392,9 +1392,9 @@ l = len(st) if l == 40: - self._parents = st[:20], st[20:40] + self._parents = (st[:20], st[20:40]) elif l == 0: - self._parents = [nullid, nullid] + self._parents = (nullid, nullid) else: raise error.Abort(_('working directory state appears ' 'damaged!'))