]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0098: Coverity: Error handling issue in win_init() v9.2.0098
authorChristian Brabandt <cb@256bit.org>
Tue, 3 Mar 2026 18:34:01 +0000 (18:34 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 3 Mar 2026 18:34:01 +0000 (18:34 +0000)
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 <cb@256bit.org>
src/version.c
src/window.c

index 1a9671db7fcde15dcc54a0a00dd1a657797d3f86..dd38ef7d9c68ec812692d118dd3de5bea7f41561 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    98,
 /**/
     97,
 /**/
index bfca2c345ae214783841bfa7878ca02230071ef8..694c2c029b767ddd33379fb8dfe679d189d645df 100644 (file)
@@ -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
 }