Patchwork [6,of,7] parsers: don't leak a reference to raise_revlog_error on success

login
register
mail settings
Submitter Augie Fackler
Date Jan. 23, 2015, 9:06 p.m.
Message ID <8dddf2c91b60c98f9f37.1422047203@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7545/
State Accepted
Commit 2cb49fba97364cc6f3df7ba2fce08d82a19419e4
Headers show

Comments

Augie Fackler - Jan. 23, 2015, 9:06 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1422046240 18000
#      Fri Jan 23 15:50:40 2015 -0500
# Branch stable
# Node ID 8dddf2c91b60c98f9f374c46d11e6a1fe28e2ab2
# Parent  b6e21fb810731af06f96f0e0315cfb0c47906735
parsers: don't leak a reference to raise_revlog_error on success

Found with cpychecker.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1262,6 +1262,7 @@  static PyObject *raise_revlog_error(void
 			goto classfail;
 		}
 		Py_INCREF(errclass);
+		Py_DECREF(mod);
 	}
 
 	errobj = PyObject_CallFunction(errclass, NULL);