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.
--- 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: