Skip to content

Conversation

Copy link

Copilot AI commented Nov 6, 2025

Addresses memory leak in XML parsing where xmlNodeGetContent() results were either not freed or freed with free() instead of the required xmlFree().

Changes

  • parse_testcase(): Store xmlNodeGetContent() results in temporary xmlChar* variables and free with xmlFree() for:
    • description field (line 1888)
    • is_negative field (line 1892)
    • argc field (line 1896)
    • arg_content in argv parsing (line 1904)
    • handler_name field (line 1914)

Example

Before:

test->description = strdup((char *)xmlNodeGetContent(cur_node));  // Memory leak
char *handler_name = (char *)xmlNodeGetContent(cur_node);
test->handler = get_handler_by_name(handler_name);
free(handler_name);  // Wrong: should be xmlFree()

After:

xmlChar *content = xmlNodeGetContent(cur_node);
test->description = strdup((char *)content);
xmlFree(content);  // Correct

xmlChar *handler_name = xmlNodeGetContent(cur_node);
test->handler = get_handler_by_name((char *)handler_name);
xmlFree(handler_name);  // Correct

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 6, 2025 10:23
Copilot AI changed the title [WIP] WIP address feedback from review on core_net_lib test app PR Fix memory leak: use xmlFree() for xmlNodeGetContent() allocations Nov 6, 2025
Copilot finished work on behalf of veeraputhiran-thangavel November 6, 2025 10:26
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

Successfully merging this pull request may close these issues.

2 participants