aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-13 10:58:02 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-13 10:58:02 +0300
commitf4eea5c198be1dcda61a94db10b8f3200888576b (patch)
treefb203419a138c5100f51995cbd7a8421348906bf /regcomp.c
parent24ddf2742b0034089bce38e5f4ebd99b93c6e161 (diff)
parent06a351f8774409db0d9c72ac4a51652f7c855c06 (diff)
downloadegawk-f4eea5c198be1dcda61a94db10b8f3200888576b.tar.gz
egawk-f4eea5c198be1dcda61a94db10b8f3200888576b.tar.bz2
egawk-f4eea5c198be1dcda61a94db10b8f3200888576b.zip
Merge branch 'master' into feature/wasted-byte
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 f58cb091..3526d9ea 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -1205,7 +1205,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;