cmark

My personal build of CMark ✏️

Commit
7dd0b6cafc7e151713d379a0e171197be43fb7d0
Parent
a90d61665a3ba565d98b4dc8a1ed44170142c6bc
Author
John MacFarlane <jgm@berkeley.edu>
Date

Avoid free(0) for link titles and URLs.

Diffstat

1 file changed, 6 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/node.c 8 6 2
diff --git 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;