Skip to content

Commit 34eb69e

Browse files
committed
Fix GH-14637: memory leak after failed heap allocation due to mem limit.
1 parent 678a481 commit 34eb69e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/xml/compat.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ _start_element_handler(void *user, const xmlChar *name, const xmlChar **attribut
7878
return;
7979
}
8080

81-
qualified_name = xmlStrdup(name);
81+
//qualified_name = xmlStrdup(name);
8282

83-
parser->h_start_element(parser->user, (const XML_Char *) qualified_name, (const XML_Char **) attributes);
83+
//parser->h_start_element(parser->user, (const XML_Char *) qualified_name, (const XML_Char **) attributes);
84+
// in case of mem limit, the interpreter bails out and exit but maybe here, unlike above which needs to copy XML attributes,
85+
// we do not need to copy the data but just using it directly?
86+
parser->h_start_element(parser->user, name, (const XML_Char **) attributes);
8487

85-
xmlFree(qualified_name);
88+
//xmlFree(qualified_name);
8689
}
8790

8891
static void

0 commit comments

Comments
 (0)