Commit 125e8e03e6ad0b99ada65bc66aaa1b1e5fc6ffbb

Rasmus Andersson 2020-10-18T10:18:11

Initializes an uninitilized variable in md_analyze_emph Fixes the following, reported by clang analysis: src/md4c.c:3729:61: warning: variable 'opener_index' may be uninitialized when used here [-Wconditional-uninitialized] MD_MARKCHAIN* opener_chain = md_mark_chain(ctx, opener_index); ^~~~~~~~~~~~ src/md4c.c:3686:25: note: initialize the variable 'opener_index' to silence this warning int opener_index; ^ = 0

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/md4c.c b/src/md4c.c
index 48b3387..9a22f62 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -3683,7 +3683,7 @@ md_analyze_emph(MD_CTX* ctx, int mark_index)
     /* If we can be a closer, try to resolve with the preceding opener. */
     if(mark->flags & MD_MARK_POTENTIAL_CLOSER) {
         MD_MARK* opener = NULL;
-        int opener_index;
+        int opener_index = 0;
 
         if(mark->ch == _T('*')) {
             MD_MARKCHAIN* opener_chains[6];