diff mercurial/cext/revlog.c @ 37873:d9e87566f879 stable

cext: stop worrying and love the free(NULL) There is no need to check for a NULL pointer before calling free since free(NULL) is defined by C standards as a no-op. Lots of software relies on this behavior so it is completely safe to call even on the most obscure of systems.
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Wed, 13 Jun 2018 10:37:39 -0400
parents a472a897c340
children 1445b556e9d2
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Sun May 20 23:05:18 2018 -0400
+++ b/mercurial/cext/revlog.c	Wed Jun 13 10:37:39 2018 -0400
@@ -319,10 +319,8 @@
 		PyMem_Free(self->offsets);
 		self->offsets = NULL;
 	}
-	if (self->nt) {
-		free(self->nt);
-		self->nt = NULL;
-	}
+	free(self->nt);
+	self->nt = NULL;
 	Py_CLEAR(self->headrevs);
 }