diff options
| author | Yuki Izumi <kivikakk@github.com> | 2016-09-26 16:20:54 +1000 | 
|---|---|---|
| committer | Yuki Izumi <kivikakk@github.com> | 2016-09-26 16:20:55 +1000 | 
| commit | 2bac4575c69ef7aba8da9e2f15af4c95644b3556 (patch) | |
| tree | f11f6faebd1978239e07b3f407e029cd25f4dbcb /src | |
| parent | 53ef343a65e3da19d605cfb7e8909004cfac954e (diff) | |
Fix memory leak in list parsing
If `parse_list_marker` returns 1, but the second part of the `&&` clause
is false, we leak `data` here.
Diffstat (limited to 'src')
| -rw-r--r-- | src/blocks.c | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/blocks.c b/src/blocks.c index 8e8c4c2..a5f8eca 100644 --- 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. | 
