diff -r ed60d2ae1935 -r c8d41c9c23c7 mercurial/parsers.c --- a/mercurial/parsers.c Thu Aug 13 17:58:33 2015 +0900 +++ b/mercurial/parsers.c Thu Aug 13 18:29:38 2015 +0900 @@ -1154,13 +1154,13 @@ tovisit = (int *)malloc((len + 1) * sizeof(int)); if (tovisit == NULL) { PyErr_NoMemory(); - goto release_reachable; + goto bail; } seen = (char *)calloc(len+1, 1); if (seen == NULL) { PyErr_NoMemory(); - goto release_seen_and_tovisit; + goto bail; } /* Populate tovisit with all the heads */ @@ -1192,7 +1192,7 @@ if (revnum != -1) { r = index_get_parents(self, revnum, parents, (int)len - 1); if (r < 0) - goto release_seen_and_tovisit; + goto bail; for (i = 0; i < 2; i++) { if (seen[parents[i] + 1] == 0 && parents[i] >= minroot) { @@ -1214,7 +1214,7 @@ r = index_get_parents(self, i, parents, (int)len - 1); /* Corrupted index file, error is set from index_get_parents */ if (r < 0) - goto release_seen_and_tovisit; + goto bail; for (k = 0; k < 2; k++) { PyObject *p = PyInt_FromLong(parents[k]); if (PySet_Contains(reachable, p) == 1) @@ -1225,13 +1225,13 @@ } } -release_seen_and_tovisit: free(seen); free(tovisit); return reachable; -release_reachable: +bail: Py_XDECREF(reachable); -bail: + free(seen); + free(tovisit); return NULL; }