aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Steinberg <dstein64@users.noreply.github.com>2021-07-11 00:32:37 -0400
committerGitHub <noreply@github.com>2021-07-10 21:32:37 -0700
commit79fe9dedcfede1d2038b47a21f21a995051deaa2 (patch)
tree417411e4f24737a718852a8c022b857be16f3d21 /src
parent936f3a4ddc543dc047ac0f7867629a37eaaf2362 (diff)
downloadrneovim-79fe9dedcfede1d2038b47a21f21a995051deaa2.tar.gz
rneovim-79fe9dedcfede1d2038b47a21f21a995051deaa2.tar.bz2
rneovim-79fe9dedcfede1d2038b47a21f21a995051deaa2.zip
window.c: address Coverity failure #14996
Check that `wip2` does not point to the same address as `wip`, to address the Coverity test failure from PR #14884. Based on the `if` clauses, `free_wininfo(wip2, ...)` is only called when `wip2->wi_win == NULL` and `wip->wi_win == wp`. I think `wip2` would only point to the same address as `wip` in scenarios where `wp` were `NULL`, which can be assumed otherwise based on the earlier code.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/window.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d051e8e467..d0bee83db1 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -4666,7 +4666,8 @@ win_free (
// If there already is an entry with "wi_win" set to NULL it
// must be removed, it would never be used.
for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next) {
- if (wip2->wi_win == NULL) {
+ // `wip2 != wip` to satisfy Coverity. #14884
+ if (wip2 != wip && wip2->wi_win == NULL) {
if (wip2->wi_next != NULL) {
wip2->wi_next->wi_prev = wip2->wi_prev;
}