summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-05 23:31:01 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-05 23:31:01 +0200
commit28550b74bb4373417eb6fbf132bd4211b7b92afa (patch)
treea4dbaf1112786060c2db9cf483f439ae600a62d3
parentc3f81394eff2b3edc7ea08405743f0d32048374a (diff)
patch 8.0.1063: Coverity warns for NULL check and array usev8.0.1063
Problem: Coverity warns for NULL check and using variable pointer as an array. Solution: Remove the NULL check. Make "argvar" an array.
-rw-r--r--src/terminal.c16
-rw-r--r--src/version.c2
2 files changed, 11 insertions, 7 deletions
diff --git a/src/terminal.c b/src/terminal.c
index b3f5f0af1c..3ceb360fbc 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -462,7 +462,7 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit)
void
ex_terminal(exarg_T *eap)
{
- typval_T argvar;
+ typval_T argvar[2];
jobopt_T opt;
char_u *cmd;
char_u *tofree = NULL;
@@ -525,8 +525,8 @@ ex_terminal(exarg_T *eap)
}
cmd = skipwhite(p);
}
- if (cmd == NULL || *cmd == NUL)
- /* Make a copy, an autocommand may set 'shell'. */
+ if (*cmd == NUL)
+ /* Make a copy of 'shell', an autocommand may change the option. */
tofree = cmd = vim_strsave(p_sh);
if (eap->addr_count > 0)
@@ -539,9 +539,10 @@ ex_terminal(exarg_T *eap)
opt.jo_in_bot = eap->line2;
}
- argvar.v_type = VAR_STRING;
- argvar.vval.v_string = cmd;
- term_start(&argvar, &opt, eap->forceit);
+ argvar[0].v_type = VAR_STRING;
+ argvar[0].vval.v_string = cmd;
+ argvar[1].v_type = VAR_UNKNOWN;
+ term_start(argvar, &opt, eap->forceit);
vim_free(tofree);
}
@@ -2886,7 +2887,8 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
&& STRCMP(job_status(buf->b_term->tl_job), "dead") == 0)
{
/* The job is dead, keep reading channel I/O until the channel is
- * closed. */
+ * closed. buf->b_term may become NULL if the terminal was closed while
+ * waiting. */
ch_log(NULL, "term_wait(): waiting for channel to close");
while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
{
diff --git a/src/version.c b/src/version.c
index 5fe8eed5bc..6be7b82553 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1063,
+/**/
1062,
/**/
1061,