parsers: correctly decref normed value after PyDict_SetItem
authorAugie Fackler <augie@google.com>
Tue, 18 Aug 2015 16:43:26 -0400
changeset 26049 b1634b7804c7
parent 26048 0be2f81aadc3
child 26050 822f46b80fa9
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.
mercurial/parsers.c
--- 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;