patch 9.2.0098: Coverity: Error handling issue in win_init()

Commit: 
https://github.com/vim/vim/commit/bc959db1639a7284ffb86be6f29891acc13d8a99
Author: Christian Brabandt <[email protected]>
Date:   Tue Mar 3 18:34:01 2026 +0000

    patch 9.2.0098: Coverity: Error handling issue in win_init()
    
    Problem:  Coverity: error handling issues in win_init() (after
              v9.2.0093)
    Solution: Only call pop_highlight_overrides() when
              push_highlight_overrides() was successful.
    
    CID: 1683100
    
    related: #19561
    
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/version.c b/src/version.c
index 1a9671db7..dd38ef7d9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    98,
 /**/
     97,
 /**/
diff --git a/src/window.c b/src/window.c
index bfca2c345..694c2c029 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1613,11 +1613,14 @@ win_init(win_T *newp, win_T *oldp, int flags UNUSED)
     win_init_some(newp, oldp);
 
 #ifdef FEAT_TERMINAL
-    // Make sure to also handle highlight overrides copied over from oldp.
-    push_highlight_overrides(newp->w_hl, newp->w_hl_len);
-    if (newp->w_buffer->b_term != NULL)
-       term_init_default_colors(newp->w_buffer->b_term);
-    pop_highlight_overrides();
+    {
+       // Make sure to also handle highlight overrides copied over from oldp.
+       bool pushed = push_highlight_overrides(newp->w_hl, newp->w_hl_len);
+       if (newp->w_buffer->b_term != NULL)
+           term_init_default_colors(newp->w_buffer->b_term);
+       if (pushed)
+           pop_highlight_overrides();
+    }
 #endif
 }
 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vxUjv-0059g4-Gc%40256bit.org.

Raspunde prin e-mail lui