Skip to content

Commit

Permalink
Fix handling ptr_stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
mity committed Jan 18, 2024
1 parent c00fe0b commit 2ee98ed
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -4124,7 +4124,7 @@ md_analyze_link_contents(MD_CTX* ctx, const MD_LINE* lines, int n_lines,
md_analyze_marks(ctx, lines, n_lines, mark_beg, mark_end, _T("@:."), MD_ANALYZE_NOSKIP_EMPH);
}

for(i = 0; i <= (int) SIZEOF_ARRAY(ctx->opener_stacks); i++)
for(i = 0; i < (int) SIZEOF_ARRAY(ctx->opener_stacks); i++)
ctx->opener_stacks[i].top = -1;
}

Expand Down Expand Up @@ -4576,10 +4576,8 @@ md_process_table_row(MD_CTX* ctx, MD_BLOCKTYPE cell_type, OFF beg, OFF end,
free(pipe_offs);

/* Free any temporary memory blocks stored within some dummy marks. */
while(ctx->ptr_stack.top >= 0) {
free(md_mark_get_ptr(ctx, ctx->ptr_stack.top));
md_mark_stack_pop(ctx, &ctx->ptr_stack);
}
for(i = ctx->ptr_stack.top; i >= 0; i = ctx->marks[i].next)
free(md_mark_get_ptr(ctx, i));
ctx->ptr_stack.top = -1;

ctx->table_cell_boundaries_head = -1;
Expand Down

0 comments on commit 2ee98ed

Please sign in to comment.