cmark

My personal build of CMark ✏️

Commit
e1f89c6141d4ed487d0b98198655ce7d7dcfd79a
Parent
aa558b2bc2e88437f8ccb95318c648fe32ece762
Author
John MacFarlane <jgm@berkeley.edu>
Date

Merge pull request #157 from kivikakk/list-parse-mem-leak

Fix memory leak in list parsing

Diffstat

1 file changed, 3 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 6 3 3
diff --git a/src/blocks.c b/src/blocks.c
@@ -933,10 +933,10 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
       *container = add_child(parser, *container, CMARK_NODE_THEMATIC_BREAK,
                              parser->first_nonspace + 1);
       S_advance_offset(parser, input, input->len - 1 - parser->offset, false);
-    } else if ((matched = parse_list_marker(
+    } else if ((!indented || cont_type == CMARK_NODE_LIST) &&
+               (matched = parse_list_marker(
                     parser->mem, input, parser->first_nonspace,
-                    (*container)->type == CMARK_NODE_PARAGRAPH, &data)) &&
-               (!indented || cont_type == CMARK_NODE_LIST)) {
+                    (*container)->type == CMARK_NODE_PARAGRAPH, &data))) {
 
       // Note that we can have new list items starting with >= 4
       // spaces indent, as long as the list container is still open.