diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 25add45f0340a..df241e5b684fc 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -111,7 +111,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) {