summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-21 17:35:32 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-21 17:35:39 -0800
commit7dd0b6cafc7e151713d379a0e171197be43fb7d0 (patch)
tree2b645bed736fbedeb4d4b10e72a1a686dcdaf12b
parenta90d61665a3ba565d98b4dc8a1ed44170142c6bc (diff)
Avoid free(0) for link titles and URLs.
-rw-r--r--src/node.c8
1 files changed, 6 insertions, 2 deletions
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;