changeset 26049:b1634b7804c7

parsers: correctly decref normed value after PyDict_SetItem Previously we were leaving this PyObject* with a refcount that was one too high. Detected with cpychecker.
author Augie Fackler <augie@google.com>
date Tue, 18 Aug 2015 16:43:26 -0400
parents 0be2f81aadc3
children 822f46b80fa9
files mercurial/parsers.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Tue Aug 18 17:15:04 2015 -0400
+++ b/mercurial/parsers.c	Tue Aug 18 16:43:26 2015 -0400
@@ -253,8 +253,11 @@
 
 			if (normed == NULL)
 				goto quit;
-			if (PyDict_SetItem(file_foldmap, normed, k) == -1)
+			if (PyDict_SetItem(file_foldmap, normed, k) == -1) {
+				Py_DECREF(normed);
 				goto quit;
+			}
+			Py_DECREF(normed);
 		}
 	}
 	return file_foldmap;