[PATCH 2 of 2] reachableroots: fix memleak of integer objects at includepath loop

Yuya Nishihara yuya at tcha.org
Fri Aug 14 05:25:33 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1439523401 -32400
#      Fri Aug 14 12:36:41 2015 +0900
# Node ID 79ba26fb19e33e202744e38a21fb7e1ec9f8358b
# Parent  949f27368952a03365a84ec81d1a6aefe4e8319a
reachableroots: fix memleak of integer objects at includepath loop

In the first visit loop, val is decref-ed correctly after PySet_Add().
Let's do the same for the includepath loop.

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1232,6 +1232,7 @@ static PyObject *reachableroots(indexObj
 						if (val == NULL)
 							goto bail;
 						PySet_Add(reachable, val);
+						Py_DECREF(val);
 					}
 					Py_DECREF(p);
 				}


More information about the Mercurial-devel mailing list