diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c index 2baf79933b4584e7a4418632ee205ebb63efd7e3_bWVyY3VyaWFsL2NleHQvbWFuaWZlc3QuYw==..ae7f27867c2acb0345f3d2101185b807ced07aab_bWVyY3VyaWFsL2NleHQvbWFuaWZlc3QuYw== 100644 --- a/mercurial/cext/manifest.c +++ b/mercurial/cext/manifest.c @@ -135,9 +135,17 @@ return 0; } +static void lazymanifest_init_early(lazymanifest *self) +{ + self->pydata = NULL; + self->lines = NULL; + self->numlines = 0; + self->maxlines = 0; +} + static int lazymanifest_init(lazymanifest *self, PyObject *args) { char *data; Py_ssize_t len; int err, ret; PyObject *pydata; @@ -138,9 +146,11 @@ static int lazymanifest_init(lazymanifest *self, PyObject *args) { char *data; Py_ssize_t len; int err, ret; PyObject *pydata; + + lazymanifest_init_early(self); if (!PyArg_ParseTuple(args, "S", &pydata)) { return -1; } @@ -668,6 +678,7 @@ if (!copy) { goto nomem; } + lazymanifest_init_early(copy); copy->numlines = self->numlines; copy->livelines = self->livelines; copy->dirty = false; @@ -705,6 +716,7 @@ if (!copy) { goto nomem; } + lazymanifest_init_early(copy); copy->dirty = true; copy->lines = malloc(self->maxlines * sizeof(line)); if (!copy->lines) {