Mercurial > hg-stable
diff mercurial/parsers.c @ 16597:b767382a8675 stable
parsers: fix refcount bug on corrupt index
When we encounter a corrupt index, we "fail" the init but our
destructor still gets called. On some systems, this was causing us to
attempt to decref a dangling to self->data.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 07 May 2012 15:40:50 -0500 |
parents | 8d44b5a2974f |
children | 48e42f984074 1d800eb9ba52 |
line wrap: on
line diff
--- a/mercurial/parsers.c Fri May 04 14:19:55 2012 +0200 +++ b/mercurial/parsers.c Mon May 07 15:40:50 2012 -0500 @@ -983,6 +983,7 @@ self->ntdepth = self->ntsplits = 0; self->ntlookups = self->ntmisses = 0; self->ntrev = -1; + Py_INCREF(self->data); if (self->inlined) { long len = inline_scan(self, NULL); @@ -998,7 +999,6 @@ self->raw_length = size / 64; self->length = self->raw_length + 1; } - Py_INCREF(self->data); return 0; bail: