Skip to content

Commit 28550b7

Browse files
committed
patch 8.0.1063: Coverity warns for NULL check and array use
Problem: Coverity warns for NULL check and using variable pointer as an array. Solution: Remove the NULL check. Make "argvar" an array.
1 parent c3f8139 commit 28550b7

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/terminal.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit)
462462
void
463463
ex_terminal(exarg_T *eap)
464464
{
465-
typval_T argvar;
465+
typval_T argvar[2];
466466
jobopt_T opt;
467467
char_u *cmd;
468468
char_u *tofree = NULL;
@@ -525,8 +525,8 @@ ex_terminal(exarg_T *eap)
525525
}
526526
cmd = skipwhite(p);
527527
}
528-
if (cmd == NULL || *cmd == NUL)
529-
/* Make a copy, an autocommand may set 'shell'. */
528+
if (*cmd == NUL)
529+
/* Make a copy of 'shell', an autocommand may change the option. */
530530
tofree = cmd = vim_strsave(p_sh);
531531

532532
if (eap->addr_count > 0)
@@ -539,9 +539,10 @@ ex_terminal(exarg_T *eap)
539539
opt.jo_in_bot = eap->line2;
540540
}
541541

542-
argvar.v_type = VAR_STRING;
543-
argvar.vval.v_string = cmd;
544-
term_start(&argvar, &opt, eap->forceit);
542+
argvar[0].v_type = VAR_STRING;
543+
argvar[0].vval.v_string = cmd;
544+
argvar[1].v_type = VAR_UNKNOWN;
545+
term_start(argvar, &opt, eap->forceit);
545546
vim_free(tofree);
546547
}
547548

@@ -2886,7 +2887,8 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
28862887
&& STRCMP(job_status(buf->b_term->tl_job), "dead") == 0)
28872888
{
28882889
/* The job is dead, keep reading channel I/O until the channel is
2889-
* closed. */
2890+
* closed. buf->b_term may become NULL if the terminal was closed while
2891+
* waiting. */
28902892
ch_log(NULL, "term_wait(): waiting for channel to close");
28912893
while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
28922894
{

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
1063,
772774
/**/
773775
1062,
774776
/**/

0 commit comments

Comments
 (0)