Skip to content

Commit b42b9fc

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.1233: Coverity warns about NULL pointer when triggering WinResized
Problem: Coverity warns about NULL pointer when triggering WinResized Solution: Add OOM checks for windows_list like for scroll_dict. Remove void casts that are unnecessary after 9.1.1084 (zeertzjq). closes: #16959 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 92e109f commit b42b9fc

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1233,
707709
/**/
708710
1232,
709711
/**/

src/window.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,7 +3285,8 @@ may_trigger_win_scrolled_resized(void)
32853285
{
32863286
// Create the list for v:event.windows before making the snapshot.
32873287
windows_list = list_alloc_with_items(size_count);
3288-
(void)check_window_scroll_resize(NULL, NULL, NULL, windows_list, NULL);
3288+
if (windows_list != NULL)
3289+
check_window_scroll_resize(NULL, NULL, NULL, windows_list, NULL);
32893290
}
32903291

32913292
dict_T *scroll_dict = NULL;
@@ -3296,8 +3297,7 @@ may_trigger_win_scrolled_resized(void)
32963297
if (scroll_dict != NULL)
32973298
{
32983299
scroll_dict->dv_refcount = 1;
3299-
(void)check_window_scroll_resize(NULL, NULL, NULL, NULL,
3300-
scroll_dict);
3300+
check_window_scroll_resize(NULL, NULL, NULL, NULL, scroll_dict);
33013301
}
33023302
}
33033303
#endif
@@ -3314,7 +3314,11 @@ may_trigger_win_scrolled_resized(void)
33143314
recursive = TRUE;
33153315

33163316
// If both are to be triggered do WinResized first.
3317-
if (trigger_resize)
3317+
if (trigger_resize
3318+
#ifdef FEAT_EVAL
3319+
&& windows_list != NULL
3320+
#endif
3321+
)
33183322
{
33193323
#ifdef FEAT_EVAL
33203324
save_v_event_T save_v_event;

0 commit comments

Comments
 (0)