D4028: revlog: remove side effect from failed nt_init()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Aug 3 09:44:47 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd814bbd22946: revlog: remove side effect from failed nt_init() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4028?vs=9728&id=9822

REVISION DETAIL
  https://phab.mercurial-scm.org/D4028

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1112,8 +1112,11 @@
 		self->ntrev = (int)index_length(self) - 1;
 		self->ntlookups = 1;
 		self->ntmisses = 0;
-		if (nt_insert(self, nullid, INT_MAX) == -1)
+		if (nt_insert(self, nullid, INT_MAX) == -1) {
+			free(self->nt);
+			self->nt = NULL;
 			return -1;
+		}
 	}
 	return 0;
 }



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list