[PATCH 1 of 2] lazymanifest: avoid 'bail' label when used on success path

Martin von Zweigbergk martinvonz at google.com
Fri May 8 16:36:09 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1428847959 25200
#      Sun Apr 12 07:12:39 2015 -0700
# Node ID e98a8adb3ec29849696e81996cc76a40e67c3905
# Parent  8179af513aebf96c4902ba3e5e3cf710d49501e4
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.

diff -r 8179af513aeb -r e98a8adb3ec2 mercurial/manifest.c
--- a/mercurial/manifest.c	Thu May 07 16:43:58 2015 -0700
+++ 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);


More information about the Mercurial-devel mailing list