patch 8.1.0194: possibly use of NULL pointer
Problem: Possibly use of NULL pointer. (Coverity)
Solution: Reset the re_in_use flag earlier.
diff --git a/src/regexp.c b/src/regexp.c
index 88cf881..9d7350b 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -8266,6 +8266,7 @@
rex.reg_endpos = NULL;
result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+ rmp->regprog->re_in_use = FALSE;
/* NFA engine aborted because it's very slow. */
if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
@@ -8284,7 +8285,11 @@
#endif
rmp->regprog = vim_regcomp(pat, re_flags);
if (rmp->regprog != NULL)
+ {
+ rmp->regprog->re_in_use = TRUE;
result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+ rmp->regprog->re_in_use = FALSE;
+ }
vim_free(pat);
}
@@ -8294,7 +8299,6 @@
rex_in_use = rex_in_use_save;
if (rex_in_use)
rex = rex_save;
- rmp->regprog->re_in_use = FALSE;
return result > 0;
}
@@ -8382,6 +8386,7 @@
result = rmp->regprog->engine->regexec_multi(
rmp, win, buf, lnum, col, tm, timed_out);
+ rmp->regprog->re_in_use = FALSE;
/* NFA engine aborted because it's very slow. */
if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
@@ -8409,8 +8414,12 @@
#endif
if (rmp->regprog != NULL)
+ {
+ rmp->regprog->re_in_use = TRUE;
result = rmp->regprog->engine->regexec_multi(
rmp, win, buf, lnum, col, tm, timed_out);
+ rmp->regprog->re_in_use = FALSE;
+ }
vim_free(pat);
}
p_re = save_p_re;
@@ -8419,7 +8428,6 @@
rex_in_use = rex_in_use_save;
if (rex_in_use)
rex = rex_save;
- rmp->regprog->re_in_use = FALSE;
return result <= 0 ? 0 : result;
}
diff --git a/src/version.c b/src/version.c
index 3c9676e..f6542b6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -790,6 +790,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 194,
+/**/
193,
/**/
192,