diff src/window.c @ 25157:9a2e7184b604 v8.2.3115

patch 8.2.3115: Coverity complains about free_wininfo() use Commit: https://github.com/vim/vim/commit/b5098060f4acae4dac3203130278c948d670a3d5 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 7 19:26:19 2021 +0200 patch 8.2.3115: Coverity complains about free_wininfo() use Problem: Coverity complains about free_wininfo() use. Solution: Add a condition that "wip2" is not equal to "wip". (Neovim https://github.com/vim/vim/issues/14996)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Jul 2021 19:30:05 +0200
parents 8f2262c72178
children 078edc1821bf
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -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;