diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 72a0720bfcb..7e37bf1e412 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -98,7 +98,7 @@ start_element_handler_ns(void *user, const xmlChar *name, const xmlChar *prefix, if (attributes != NULL) { xmlChar *qualified_name_attr = NULL; - attrs = safe_emalloc((nb_attributes * 2) + 1, sizeof(int *), 0); + attrs = safe_emalloc(nb_attributes, 2 * sizeof(int *), sizeof(int *)); for (i = 0; i < nb_attributes; i += 1) {