diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-07-17 21:27:52 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-07-17 21:27:52 +0200 |
commit | cfdbc5adde49cbab939e8164555ed0b8d9ce000b (patch) | |
tree | 9e7ef1a1d37047c93589689a32a0b55f42ff95cb | |
parent | 99a764bccd995a6cfe3206909f0076ef84d77506 (diff) | |
download | vim-git-cfdbc5adde49cbab939e8164555ed0b8d9ce000b.tar.gz |
patch 8.1.1707: Coverity warns for possibly using a NULL pointerv8.1.1707
Problem: Coverity warns for possibly using a NULL pointer.
Solution: Change the logic to make sure no NULL pointer is used.
-rw-r--r-- | src/popupwin.c | 7 | ||||
-rw-r--r-- | src/testdir/test_popupwin.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/popupwin.c b/src/popupwin.c index e61b793cd..322537bf8 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -587,14 +587,13 @@ apply_general_options(win_T *wp, dict_T *dict) di = dict_find(dict, (char_u *)"mask", -1); if (di != NULL) { - int ok = TRUE; + int ok = FALSE; - if (di->di_tv.v_type != VAR_LIST) - ok = FALSE; - else if (di->di_tv.vval.v_list != NULL) + if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) { listitem_T *li; + ok = TRUE; for (li = di->di_tv.vval.v_list->lv_first; li != NULL; li = li->li_next) { diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 8b1ea1f6f..26d1c94ae 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -643,6 +643,10 @@ func Test_popup_invalid_arguments() call popup_clear() call assert_fails('call popup_create([#{text: "text", props: ["none"]}], {})', 'E715:') call popup_clear() + call assert_fails('call popup_create("text", #{mask: ["asdf"]})', 'E475:') + call popup_clear() + call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:') + call popup_clear() endfunc func Test_win_execute_closing_curwin() diff --git a/src/version.c b/src/version.c index 573f74142..b1187db57 100644 --- a/src/version.c +++ b/src/version.c @@ -778,6 +778,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1707, +/**/ 1706, /**/ 1705, |