From f5dbafafed95e496380b7133c3f4850bd6c78a7e Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Tue, 24 Feb 2004 12:03:32 +0000 Subject: [PATCH] fix win32 compile with libxml 2.6 fix mem leaks --- ext/xml/compat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.50.1