From: Rob Richards Date: Tue, 24 Feb 2004 12:03:32 +0000 (+0000) Subject: fix win32 compile with libxml 2.6 X-Git-Tag: RELEASE_0_2_0~195 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5dbafafed95e496380b7133c3f4850bd6c78a7e;p=php fix win32 compile with libxml 2.6 fix mem leaks --- diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 4c8cb01f05..e6590c6987 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -82,9 +82,9 @@ _start_element_handler_ns(void *user, const xmlChar *name, const xmlChar *prefix _qualify_namespace(parser, name, URI, &qualified_name); if (attributes != NULL) { - attrs = safe_emalloc((nb_attributes * 2) + 1, sizeof(int *), 0); xmlChar *qualified_name_attr = NULL; - + attrs = safe_emalloc((nb_attributes * 2) + 1, sizeof(int *), 0); + for (i = 0; i < nb_attributes; i += 1) { if (attributes[y+1] != NULL) { @@ -102,6 +102,9 @@ _start_element_handler_ns(void *user, const xmlChar *name, const xmlChar *prefix } parser->h_start_element(parser->user, (const XML_Char *) qualified_name, (const XML_Char **) attrs); if (attrs) { + for (i = 0; i < z; i++) { + xmlFree(attrs[i]); + } efree(attrs); } xmlFree(qualified_name);