diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -352,6 +352,7 @@ dirstate_item_from_v1_data(char state, i
 		PyErr_Format(PyExc_RuntimeError,
 		             "unknown state: `%c` (%d, %d, %d)", state, mode,
 		             size, mtime, NULL);
+		Py_DECREF(t);
 		return NULL;
 	}