diff --git a/HTMLparser.c b/HTMLparser.c
index 9079fa8a..1520663b 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -6743,6 +6743,8 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
ctxt->nameNr = 0;
ctxt->name = NULL;
+ ctxt->nsNr = 0;
+
DICT_FREE(ctxt->version);
ctxt->version = NULL;
DICT_FREE(ctxt->encoding);