summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-30 07:59:53 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-30 07:59:53 -0800
commit46b67b710788be7924b5a412ab68eea3cac0cd96 (patch)
treef138edcd3c9895e4cdf7b2be31f950f5d6b49229 /src
parentcdcd29f27a25334817026afaf4501bb146d66f10 (diff)
man: use a variable to store the char * from node_get_url.
We get segfaults on some platforms when we do cmark_strbuf_printf(man, " (%s)", cmark_node_get_url(node)); but they go away with: url = cmark_node_get_url(node); cmark_strbuf_printf(man, " (%s)", url); I don't understand why. Closes #253.
Diffstat (limited to 'src')
-rw-r--r--src/man.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/man.c b/src/man.c
index 1b45f8b..3470343 100644
--- a/src/man.c
+++ b/src/man.c
@@ -49,6 +49,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
cmark_node *tmp;
cmark_strbuf *man = state->man;
int list_number;
+ const char *url;
bool entering = (ev_type == CMARK_EVENT_ENTER);
if (state->plain == node) { // back at original node
@@ -203,8 +204,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
case CMARK_NODE_LINK:
if (!entering) {
- cmark_strbuf_printf(man, " (%s)",
- cmark_node_get_url(node));
+ url = cmark_node_get_url(node);
+ cmark_strbuf_printf(man, " (%s)", url);
}
break;