changeset 23942:fefa5f2a1730 stable

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
author Augie Fackler <augie@google.com>
date Fri, 23 Jan 2015 15:19:04 -0500
parents 164bd5218ddb
children 5fb44983a696
files mercurial/parsers.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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];