summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuki Izumi <kivikakk@github.com>2016-09-26 15:44:36 +1000
committerYuki Izumi <kivikakk@github.com>2016-09-26 15:44:37 +1000
commitf4e9ba2068880d25034ebeca172e521d34d6b540 (patch)
treea1cf9403f32b3fc1cb408e21b2456068ca3ea931 /src
parent53ef343a65e3da19d605cfb7e8909004cfac954e (diff)
Use cmark_mem to free where used to alloc
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c2
-rw-r--r--src/inlines.c4
-rw-r--r--src/references.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/blocks.c b/src/blocks.c
index 8e8c4c2..bfd64d8 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -989,7 +989,7 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
parser->first_nonspace + 1);
/* TODO: static */
memcpy(&((*container)->as.list), data, sizeof(*data));
- free(data);
+ parser->mem->free(data);
} else if (indented && !maybe_lazy && !parser->blank) {
S_advance_offset(parser, input, CODE_INDENT, true);
*container = add_child(parser, *container, CMARK_NODE_CODE_BLOCK,
diff --git a/src/inlines.c b/src/inlines.c
index 586279f..1c998b3 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -353,7 +353,7 @@ static void remove_delimiter(subject *subj, delimiter *delim) {
if (delim->previous != NULL) {
delim->previous->next = delim->next;
}
- free(delim);
+ subj->mem->free(delim);
}
static void pop_bracket(subject *subj) {
@@ -362,7 +362,7 @@ static void pop_bracket(subject *subj) {
return;
b = subj->last_bracket;
subj->last_bracket = subj->last_bracket->previous;
- free(b);
+ subj->mem->free(b);
}
static void push_delimiter(subject *subj, unsigned char c, bool can_open,
diff --git a/src/references.c b/src/references.c
index e141213..89f2dc8 100644
--- a/src/references.c
+++ b/src/references.c
@@ -46,7 +46,7 @@ static unsigned char *normalize_reference(cmark_mem *mem, cmark_chunk *ref) {
assert(result);
if (result[0] == '\0') {
- free(result);
+ mem->free(result);
return NULL;
}
@@ -114,7 +114,7 @@ cmark_reference *cmark_reference_lookup(cmark_reference_map *map,
ref = ref->next;
}
- free(norm);
+ map->mem->free(norm);
return ref;
}
@@ -135,7 +135,7 @@ void cmark_reference_map_free(cmark_reference_map *map) {
}
}
- free(map);
+ map->mem->free(map);
}
cmark_reference_map *cmark_reference_map_new(cmark_mem *mem) {