]> granicus.if.org Git - vim/commitdiff
patch 8.2.3115: Coverity complains about free_wininfo() use v8.2.3115
authorBram Moolenaar <Bram@vim.org>
Wed, 7 Jul 2021 17:26:19 +0000 (19:26 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 7 Jul 2021 17:26:19 +0000 (19:26 +0200)
Problem:    Coverity complains about free_wininfo() use.
Solution:   Add a condition that "wip2" is not equal to "wip". (Neovim #14996)

src/version.c
src/window.c

index 7dfbe6dd8f43128cccf2943bd7336b55622a8f25..e2f74e926cc4f7f96b1cd0ab8700599d4918fcb5 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3115,
 /**/
     3114,
 /**/
index 09067b081d9561ef31311c2a074579008d85de48..cc9c217b47fa8be81ad74e700a9e7712ec162a72 100644 (file)
@@ -5057,8 +5057,9 @@ win_free(
 
                // If there already is an entry with "wi_win" set to NULL it
                // must be removed, it would never be used.
+               // Skip "wip" itself, otherwise Coverity complains.
                for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next)
-                   if (wip2->wi_win == NULL)
+                   if (wip2 != wip && wip2->wi_win == NULL)
                    {
                        if (wip2->wi_next != NULL)
                            wip2->wi_next->wi_prev = wip2->wi_prev;