summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-08 12:05:19 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-09 13:21:37 -0800
commit18207addd5d922a9ca1ec6e83a895108f13e3c25 (patch)
tree1019232d0c6f0d41ba8fe37461fe56ac221c7f66 /src/inlines.c
parentea81ce0001cb842586af381f98f43e10caa8a8dc (diff)
Fixed allocation issue.
Diffstat (limited to 'src/inlines.c')
-rw-r--r--src/inlines.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 3e3ef0a..937c33f 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -634,7 +634,6 @@ static node_inl* handle_close_bracket(subject* subj, node_inl **last)
unsigned char *url, *title;
opener_stack *ostack = subj->openers;
node_inl *link_text;
- node_inl *tmp;
node_inl *inl;
chunk raw_label;
@@ -696,18 +695,16 @@ static node_inl* handle_close_bracket(subject* subj, node_inl **last)
subj->pos = subj->pos + scan_spacechars(&subj->input, subj->pos);
raw_label = chunk_literal("");
if (!link_label(subj, &raw_label) || raw_label.len == 0) {
- chunk_free(&raw_label);
+ // chunk_free(&raw_label);
raw_label = chunk_dup(&subj->input, ostack->position, initial_pos - ostack->position - 1);
}
- log_info("looking up '%s'", chunk_to_cstr(&raw_label));
ref = reference_lookup(subj->refmap, &raw_label);
chunk_free(&raw_label);
if (ref != NULL) { // found
- log_info("ref found url{%s} title{%s}", ref->url, ref->title);
- url = ref->url;
- title = ref->title;
+ url = bufdup(ref->url);
+ title = bufdup(ref->title);
goto match;
} else {
goto noMatch;
@@ -719,7 +716,6 @@ noMatch:
return make_str(chunk_literal("]"));
match:
- tmp = link_text->next;
inl = ostack->first_inline;
inl->tag = is_image ? INL_IMAGE : INL_LINK;
chunk_free(&inl->content.literal);
@@ -727,10 +723,10 @@ match:
inl->content.linkable.url = url;
inl->content.linkable.title = title;
inl->next = NULL;
+ *last = inl;
// remove this opener and all later ones from stack:
free_openers(subj, ostack->previous);
- *last = inl;
return NULL;
}