Skip to content
New issue

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

Fix Memory Leaks #3

Open
Zelmoghazy opened this issue May 5, 2023 · 1 comment
Open

Fix Memory Leaks #3

Zelmoghazy opened this issue May 5, 2023 · 1 comment

Comments

@Zelmoghazy
Copy link

void XML_free(XMLNode *node)
{
    for (int i = 0; i < node->children.size; i++) {
        XML_free(node->children.data[i]);
    }
    free(node->children.data);
    XMLNode_free(node);
}

The XMLDocument_free function doesnt really free the XML tree it only frees the root node, I think this frees the entire tree tested with valgrind although relying on recursion is not a good idea an iterative version is more complicated.

@calum904
Copy link

@Zelmoghazy I have addressed this on a forked repository pending PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants