mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Fix potential memleak.
This commit is contained in:
parent
e159007aca
commit
864ba94a88
@ -129,6 +129,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
|||||||
struct rxml_attrib_node *list = NULL;
|
struct rxml_attrib_node *list = NULL;
|
||||||
struct rxml_attrib_node *tail = NULL;
|
struct rxml_attrib_node *tail = NULL;
|
||||||
|
|
||||||
|
char *attrib = NULL;
|
||||||
|
char *value = NULL;
|
||||||
char *save;
|
char *save;
|
||||||
const char *elem = strtok_r(copy, " \n\t\f\v\r", &save);
|
const char *elem = strtok_r(copy, " \n\t\f\v\r", &save);
|
||||||
while (elem)
|
while (elem)
|
||||||
@ -152,6 +154,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
|||||||
|
|
||||||
new_node->attrib = attrib;
|
new_node->attrib = attrib;
|
||||||
new_node->value = value;
|
new_node->value = value;
|
||||||
|
attrib = NULL;
|
||||||
|
value = NULL;
|
||||||
|
|
||||||
if (tail)
|
if (tail)
|
||||||
{
|
{
|
||||||
@ -166,6 +170,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
|||||||
|
|
||||||
end:
|
end:
|
||||||
free(copy);
|
free(copy);
|
||||||
|
free(attrib);
|
||||||
|
free(value);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user