mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(RXML) Fix memory leak
This commit is contained in:
parent
f37d38bcd4
commit
5c50d2f389
@ -143,16 +143,6 @@ rxml_document_t *rxml_load_document_string(const char *str)
|
||||
if (!doc)
|
||||
goto error;
|
||||
|
||||
doc->root_node = (struct rxml_node *)malloc(
|
||||
sizeof(*doc->root_node));
|
||||
|
||||
doc->root_node->name = NULL;
|
||||
doc->root_node->data = NULL;
|
||||
doc->root_node->attrib = NULL;
|
||||
|
||||
doc->root_node->children = NULL;
|
||||
doc->root_node->next = NULL;
|
||||
|
||||
yxml_init(&x, buf->xml, BUFSIZE);
|
||||
|
||||
for (; *str; ++str)
|
||||
@ -256,30 +246,14 @@ rxml_document_t *rxml_load_document_string(const char *str)
|
||||
|
||||
case YXML_ATTRSTART:
|
||||
if (attr)
|
||||
{
|
||||
struct rxml_attrib_node
|
||||
*new_node = (struct rxml_attrib_node*)
|
||||
calloc(1, sizeof(*attr));
|
||||
attr = new_node;
|
||||
attr->next = new_node ;
|
||||
}
|
||||
attr = attr->next = (struct rxml_attrib_node*)
|
||||
calloc(1, sizeof(*attr));
|
||||
else
|
||||
{
|
||||
struct rxml_attrib_node
|
||||
*new_node = (struct rxml_attrib_node*)
|
||||
calloc(1, sizeof(*attr));
|
||||
attr = new_node;
|
||||
|
||||
if (node)
|
||||
node->attrib = new_node;
|
||||
}
|
||||
attr = node->attrib = (struct rxml_attrib_node*)calloc(1, sizeof(*attr));
|
||||
|
||||
if (attr)
|
||||
{
|
||||
if (attr->attrib)
|
||||
free(attr->attrib);
|
||||
attr->attrib = strdup(x.attr);
|
||||
}
|
||||
if (attr->attrib)
|
||||
free(attr->attrib);
|
||||
attr->attrib = strdup(x.attr);
|
||||
|
||||
valptr = buf->val;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user