# HG changeset patch # User Josef 'Jeff' Sipek <jef...@josefsipek.net> # Date 1528900880 14400 # Wed Jun 13 10:41:20 2018 -0400 # Branch stable # Node ID d591c80025ee7316b77235b2d71c4b0f01c03123 # Parent cbb47a946bc0e0346bfc9f9ba505f9475de43606 lazymanifest: don't crash when out of memory (issue5916)
self->lines can be NULL if we failed to allocate memory for it. diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c --- a/mercurial/cext/manifest.c +++ b/mercurial/cext/manifest.c @@ -185,7 +185,7 @@ static void lazymanifest_dealloc(lazyman { /* free any extra lines we had to allocate */ int i; - for (i = 0; i < self->numlines; i++) { + for (i = 0; self->lines && (i < self->numlines); i++) { if (self->lines[i].from_malloc) { free(self->lines[i].start); } _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel