0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.1500: possible NULL pointer dereference

Problem:    Possible NULL pointer dereference. (Coverity)
Solution:   Check for the pointer not being NULL.
This commit is contained in:
Bram Moolenaar
2018-02-11 15:02:48 +01:00
parent 4b7e7bed6c
commit 0549a1e184
2 changed files with 9 additions and 9 deletions

View File

@@ -3771,7 +3771,7 @@ ex_make(exarg_T *eap)
{ {
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf); 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; res = qi->qf_lists[qi->qf_curlist].qf_count;
else else
res = 0; res = 0;
@@ -4165,20 +4165,18 @@ ex_cfile(exarg_T *eap)
if (res >= 0 && qi != NULL) if (res >= 0 && qi != NULL)
qf_list_changed(qi, qi->qf_curlist); qf_list_changed(qi, qi->qf_curlist);
#ifdef FEAT_AUTOCMD #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) if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
/*
* Autocmd might have freed the quickfix/location list. Check whether it is /* An autocmd might have freed the quickfix/location list. Check whether it
* still valid * is still valid. */
*/ if (qi != NULL && !qflist_valid(wp, save_qfid))
if (!qflist_valid(wp, save_qfid))
return; return;
#endif #endif
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
{
qf_jump(qi, 0, 0, eap->forceit); /* display first error */ qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
} }
/* /*

View File

@@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1500,
/**/ /**/
1499, 1499,
/**/ /**/