mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +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)
|
SOURCES := $(wildcard *.c)
|
||||||
OBJS := $(SOURCES:.c=.o)
|
OBJS := $(SOURCES:.c=.o)
|
||||||
|
|
||||||
CFLAGS += -Wall -pedantic -std=gnu99 -O3 -g
|
CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -O0 -g
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "../../boolean.h"
|
#include "../../boolean.h"
|
||||||
|
|
||||||
|
#ifndef RXML_TEST
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct rxml_document
|
struct rxml_document
|
||||||
{
|
{
|
||||||
@ -53,6 +56,8 @@ static void rxml_free_node(struct rxml_node *node)
|
|||||||
head = next_attrib;
|
head = next_attrib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(node->name);
|
||||||
|
free(node->data);
|
||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +350,9 @@ static char *purge_xml_comments(const char *str)
|
|||||||
|
|
||||||
rxml_document_t *rxml_load_document(const char *path)
|
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");
|
RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
char *memory_buffer = NULL;
|
char *memory_buffer = NULL;
|
||||||
char *new_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)
|
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);
|
fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value);
|
||||||
|
|
||||||
if (node->childs)
|
if (node->children)
|
||||||
print_siblings(node->childs, level + 1);
|
print_siblings(node->children, level + 1);
|
||||||
|
|
||||||
if (node->next)
|
if (node->next)
|
||||||
print_siblings(node->next, level);
|
print_siblings(node->next, level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user