diff --git a/mwparserfromhell/parser/tokenizer.c b/mwparserfromhell/parser/tokenizer.c index 18972aa..a8c69e7 100644 --- a/mwparserfromhell/parser/tokenizer.c +++ b/mwparserfromhell/parser/tokenizer.c @@ -1452,7 +1452,7 @@ init_tokenizer(void) Py_DECREF(htmlentitydefs); unsigned numdefs = (unsigned) PyDict_Size(defmap); - entitydefs = malloc(numdefs * sizeof(char*)); + entitydefs = calloc(numdefs + 1, sizeof(char*)); PyObject* deflist = PyDict_Keys(defmap); if (!deflist) return; Py_DECREF(defmap);