Patchwork [2,of,5,stable,cpychecker] dirs: fix leak of iterator in dirs_fromiter

login
register
mail settings
Submitter Augie Fackler
Date Jan. 27, 2015, 3:26 p.m.
Message ID <190d25e48de681423dac.1422372393@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7561/
State Accepted
Commit bca4b6f126f2457867d7477cc9bde2c965359847
Headers show

Comments

Augie Fackler - Jan. 27, 2015, 3:26 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1422371404 18000
#      Tue Jan 27 10:10:04 2015 -0500
# Branch stable
# Node ID 190d25e48de681423dac253939139a970e46cfc1
# Parent  25af70176080cd54761b1624c900dc19252c9994
dirs: fix leak of iterator in dirs_fromiter

Spotted with cpychecker.

Patch

diff --git a/mercurial/dirs.c b/mercurial/dirs.c
--- a/mercurial/dirs.c
+++ b/mercurial/dirs.c
@@ -175,6 +175,7 @@  static int dirs_fromiter(PyObject *dirs,
 	}
 
 	ret = PyErr_Occurred() ? -1 : 0;
+	Py_DECREF(iter);
 	Py_XDECREF(item);
 	return ret;
 }