parsers: fix leak of err when asciilower hits a unicode decode error stable
authorAugie Fackler <augie@google.com>
Fri, 23 Jan 2015 15:19:04 -0500
branchstable
changeset 23942 fefa5f2a1730
parent 23941 164bd5218ddb
child 23943 5fb44983a696
parsers: fix leak of err when asciilower hits a unicode decode error This is one of many errors detected in parsers.c by cpychecker[1]. I haven't gone through all of them yet. 1: https://gcc-python-plugin.readthedocs.org/en/latest/index.html
mercurial/parsers.c
--- a/mercurial/parsers.c	Fri Jan 23 18:41:37 2015 +0100
+++ b/mercurial/parsers.c	Fri Jan 23 15:19:04 2015 -0500
@@ -115,6 +115,7 @@
 				"ascii", str, len, i, (i + 1),
 				"unexpected code byte");
 			PyErr_SetObject(PyExc_UnicodeDecodeError, err);
+			Py_XDECREF(err);
 			goto quit;
 		}
 		newstr[i] = lowertable[(unsigned char)c];