diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-11 15:02:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-11 15:02:48 +0100 |
commit | 0549a1e184d33674f4c2b8fb44ccdf6b9b9808a3 (patch) | |
tree | 922943e3f90a09cb3319ab04bd344faaeb917abc | |
parent | 4b7e7bed6cb16c8256e6973418701cfb15b30b8e (diff) |
patch 8.0.1500: possible NULL pointer dereferencev8.0.1500
Problem: Possible NULL pointer dereference. (Coverity)
Solution: Check for the pointer not being NULL.
-rw-r--r-- | src/quickfix.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index c3b28e4ec3..8030810387 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3771,7 +3771,7 @@ ex_make(exarg_T *eap) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - if (qi->qf_curlist < qi->qf_listcount) + if (qi != NULL && qi->qf_curlist < qi->qf_listcount) res = qi->qf_lists[qi->qf_curlist].qf_count; else res = 0; @@ -4165,20 +4165,18 @@ ex_cfile(exarg_T *eap) if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); #ifdef FEAT_AUTOCMD - save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; + if (qi != NULL) + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); - /* - * Autocmd might have freed the quickfix/location list. Check whether it is - * still valid - */ - if (!qflist_valid(wp, save_qfid)) + + /* An autocmd might have freed the quickfix/location list. Check whether it + * is still valid. */ + if (qi != NULL && !qflist_valid(wp, save_qfid)) return; #endif if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) - { qf_jump(qi, 0, 0, eap->forceit); /* display first error */ - } } /* diff --git a/src/version.c b/src/version.c index a7cc0e41ef..4cbfc47091 100644 --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1500, +/**/ 1499, /**/ 1498, |