lazymanifest: avoid 'bail' label when used on success path
authorMartin von Zweigbergk <martinvonz@google.com>
Sun, 12 Apr 2015 07:12:39 -0700
changeset 24974 46408b80c3a1
parent 24973 4c4d0012db4f
child 24975 89c2bf63a83b
lazymanifest: avoid 'bail' label when used on success path 3d485727e45e (lazymanifest: extract function for iterating to next line, 2015-03-11) introduced a large memory leak because I stopped running the 'bail' block in the successful case. Let's rename 'bail' to 'done', since it has to run not only in the error case.
mercurial/manifest.c
--- a/mercurial/manifest.c	Wed May 06 13:15:39 2015 -0400
+++ b/mercurial/manifest.c	Sun Apr 12 07:12:39 2015 -0700
@@ -235,7 +235,7 @@
 	PyObject *ret = NULL, *path = NULL, *hash = NULL, *flags = NULL;
 	l = lmiter_nextline((lmIter *)o);
 	if (!l) {
-		goto bail;
+		goto done;
 	}
 	pl = pathlen(l);
 	path = PyString_FromStringAndSize(l->start, pl);
@@ -244,10 +244,10 @@
 	flags = PyString_FromStringAndSize(l->start + consumed,
 									   l->len - consumed - 1);
 	if (!path || !hash || !flags) {
-		goto bail;
+		goto done;
 	}
 	ret = PyTuple_Pack(3, path, hash, flags);
- bail:
+ done:
 	Py_XDECREF(path);
 	Py_XDECREF(hash);
 	Py_XDECREF(flags);