We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clone_node()
While investigating #3098, I noticed that Gumbo's clone_node() function doesn't make a copy of nonstandard tag names.
I think this is the fix
diff --git a/gumbo-parser/src/parser.c b/gumbo-parser/src/parser.c index 67812b23..c3e5e038 100644 --- a/gumbo-parser/src/parser.c +++ b/gumbo-parser/src/parser.c @@ -1377,6 +1377,9 @@ static GumboNode* clone_node ( *new_node = *node; new_node->parent = NULL; new_node->index_within_parent = -1; + + if (node->v.element.tag == GUMBO_TAG_UNKNOWN) + new_node->v.element.name = gumbo_strdup(node->v.element.name); // Clear the GUMBO_INSERTION_IMPLICIT_END_TAG flag, as the cloned node may // have a separate end tag. new_node->parse_flags &= ~GUMBO_INSERTION_IMPLICIT_END_TAG;
but I'd like to understand why this hasn't been causing a bunch of memory leaks first.
The text was updated successfully, but these errors were encountered:
stevecheckoway
No branches or pull requests
While investigating #3098, I noticed that Gumbo's
clone_node()
function doesn't make a copy of nonstandard tag names.I think this is the fix
but I'd like to understand why this hasn't been causing a bunch of memory leaks first.
The text was updated successfully, but these errors were encountered: