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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2015, 10:25 a.m.
Message ID <79ba26fb19e33e202744.1439547933@mimosa>
Download mbox | patch
Permalink /patch/10212/
State Accepted
Commit 9e7d805925c87cfa0ca30819e8273ac37fd77a62
Headers show

Comments

Yuya Nishihara - Aug. 14, 2015, 10:25 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Matt Mackall - Aug. 14, 2015, 8:30 p.m.
On Fri, 2015-08-14 at 19:25 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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

These are queued for default, thanks.

Patch

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);
 				}