Welcome to little lamb

Code » md4c » commit cbae179

md_analyze_line: Fix propagation of uninitialized variable.

author Martin Mitas
2019-02-18 10:55:17 UTC
committer Martin Mitas
2019-02-18 10:55:17 UTC
parent 30cfd4e38b46623fdd948442a14452ae7b095002

md_analyze_line: Fix propagation of uninitialized variable.

Actually it should not be harmful because the consumer should use the
variable MD_CONTAINER::task_mark_off only when MD_CONTAINER::is_task
flag is set and it that case the task_mark_off _is_ initialized.

(CID 1476829)

md4c/md4c.c +3 -2

diff --git a/md4c/md4c.c b/md4c/md4c.c
index e73d996..4c0ad5c 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -5252,7 +5252,8 @@ md_enter_child_containers(MD_CTX* ctx, int n_children, unsigned data)
                                 (is_ordered_list ? MD_BLOCK_OL : MD_BLOCK_UL),
                                 c->start, data, MD_BLOCK_CONTAINER_OPENER));
                 MD_CHECK(md_push_container_bytes(ctx, MD_BLOCK_LI,
-                                c->task_mark_off, (c->is_task ? CH(c->task_mark_off) : 0),
+                                c->task_mark_off,
+                                (c->is_task ? CH(c->task_mark_off) : 0),
                                 MD_BLOCK_CONTAINER_OPENER));
                 break;
 
@@ -5394,7 +5395,7 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
     int n_parents = 0;
     int n_brothers = 0;
     int n_children = 0;
-    MD_CONTAINER container;
+    MD_CONTAINER container = { 0 };
     int prev_line_has_list_loosening_effect = ctx->last_line_has_list_loosening_effect;
     OFF off = beg;
     int ret = 0;