Skip to content

Commit 4149980

Browse files
committed
patch 8.1.0194: possibly use of NULL pointer
Problem: Possibly use of NULL pointer. (Coverity) Solution: Reset the re_in_use flag earlier.
1 parent ca4cc01 commit 4149980

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/regexp.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8266,6 +8266,7 @@ vim_regexec_string(
82668266
rex.reg_endpos = NULL;
82678267

82688268
result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
8269+
rmp->regprog->re_in_use = FALSE;
82698270

82708271
/* NFA engine aborted because it's very slow. */
82718272
if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
@@ -8284,7 +8285,11 @@ vim_regexec_string(
82848285
#endif
82858286
rmp->regprog = vim_regcomp(pat, re_flags);
82868287
if (rmp->regprog != NULL)
8288+
{
8289+
rmp->regprog->re_in_use = TRUE;
82878290
result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
8291+
rmp->regprog->re_in_use = FALSE;
8292+
}
82888293
vim_free(pat);
82898294
}
82908295

@@ -8294,7 +8299,6 @@ vim_regexec_string(
82948299
rex_in_use = rex_in_use_save;
82958300
if (rex_in_use)
82968301
rex = rex_save;
8297-
rmp->regprog->re_in_use = FALSE;
82988302

82998303
return result > 0;
83008304
}
@@ -8382,6 +8386,7 @@ vim_regexec_multi(
83828386

83838387
result = rmp->regprog->engine->regexec_multi(
83848388
rmp, win, buf, lnum, col, tm, timed_out);
8389+
rmp->regprog->re_in_use = FALSE;
83858390

83868391
/* NFA engine aborted because it's very slow. */
83878392
if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
@@ -8409,8 +8414,12 @@ vim_regexec_multi(
84098414
#endif
84108415

84118416
if (rmp->regprog != NULL)
8417+
{
8418+
rmp->regprog->re_in_use = TRUE;
84128419
result = rmp->regprog->engine->regexec_multi(
84138420
rmp, win, buf, lnum, col, tm, timed_out);
8421+
rmp->regprog->re_in_use = FALSE;
8422+
}
84148423
vim_free(pat);
84158424
}
84168425
p_re = save_p_re;
@@ -8419,7 +8428,6 @@ vim_regexec_multi(
84198428
rex_in_use = rex_in_use_save;
84208429
if (rex_in_use)
84218430
rex = rex_save;
8422-
rmp->regprog->re_in_use = FALSE;
84238431

84248432
return result <= 0 ? 0 : result;
84258433
}

src/version.c

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

790790
static int included_patches[] =
791791
{ /* Add new patch number below this line */
792+
/**/
793+
194,
792794
/**/
793795
193,
794796
/**/

0 commit comments

Comments
 (0)