aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index a3148c0e..f3dcb3ea 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -1217,7 +1217,12 @@ analyze (regex_t *preg)
|| dfa->eclosures == NULL, 0))
return REG_ESPACE;
- dfa->subexp_map = re_malloc (int, preg->re_nsub);
+ /* some malloc()-checkers don't like zero allocations */
+ if (preg->re_nsub > 0)
+ dfa->subexp_map = re_malloc (int, preg->re_nsub);
+ else
+ dfa->subexp_map = NULL;
+
if (dfa->subexp_map != NULL)
{
int i;