From 7dd0b6cafc7e151713d379a0e171197be43fb7d0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 21 Jan 2015 17:35:32 -0800 Subject: Avoid free(0) for link titles and URLs. --- src/node.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/node.c b/src/node.c index 9cdfbe9..fe3dac3 100644 --- a/src/node.c +++ b/src/node.c @@ -122,8 +122,12 @@ void S_free_nodes(cmark_node *e) break; case NODE_LINK: case NODE_IMAGE: - free(e->as.link.url); - free(e->as.link.title); + if (e->as.link.url) { + free(e->as.link.url); + } + if (e->as.link.title) { + free(e->as.link.title); + } break; default: break; -- cgit v1.2.3