mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-21 03:50:28 +00:00
Fix memory leaks in rxml.
This commit is contained in:
parent
78a8e03f2f
commit
a882177f33
@ -3,7 +3,7 @@ TARGET := rxml
|
||||
SOURCES := $(wildcard *.c)
|
||||
OBJS := $(SOURCES:.c=.o)
|
||||
|
||||
CFLAGS += -Wall -pedantic -std=gnu99 -O3 -g
|
||||
CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -O0 -g
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
@ -21,7 +21,10 @@
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include "../../boolean.h"
|
||||
|
||||
#ifndef RXML_TEST
|
||||
#include "../../general.h"
|
||||
#endif
|
||||
|
||||
struct rxml_document
|
||||
{
|
||||
@ -53,6 +56,8 @@ static void rxml_free_node(struct rxml_node *node)
|
||||
head = next_attrib;
|
||||
}
|
||||
|
||||
free(node->name);
|
||||
free(node->data);
|
||||
free(node);
|
||||
}
|
||||
|
||||
@ -345,7 +350,9 @@ static char *purge_xml_comments(const char *str)
|
||||
|
||||
rxml_document_t *rxml_load_document(const char *path)
|
||||
{
|
||||
#ifndef RXML_TEST
|
||||
RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n");
|
||||
#endif
|
||||
|
||||
char *memory_buffer = NULL;
|
||||
char *new_memory_buffer = NULL;
|
||||
|
@ -25,8 +25,8 @@ static void print_siblings(struct rxml_node *node, unsigned level)
|
||||
for (const struct rxml_attrib_node *attrib = node->attrib; attrib; attrib = attrib->next)
|
||||
fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value);
|
||||
|
||||
if (node->childs)
|
||||
print_siblings(node->childs, level + 1);
|
||||
if (node->children)
|
||||
print_siblings(node->children, level + 1);
|
||||
|
||||
if (node->next)
|
||||
print_siblings(node->next, level);
|
||||
|
Loading…
x
Reference in New Issue
Block a user