Skip to content

Commit 8b8eb2c

Browse files
author
Ilia Alshanetsky
committed
Fixed potential use of un-initialized var (detected by Coverity)
1 parent 24b2efa commit 8b8eb2c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ext/ereg/regex/regcomp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,11 @@ register struct re_guts *g;
15531553
if (g->mlen == 0) /* there isn't one */
15541554
return;
15551555

1556+
if (!start) {
1557+
g->mlen = 0;
1558+
return;
1559+
}
1560+
15561561
/* turn it into a character string */
15571562
g->must = malloc((size_t)g->mlen + 1);
15581563
if (g->must == NULL) { /* argh; just forget it */

regex/regcomp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,11 @@ register struct re_guts *g;
15531553
if (g->mlen == 0) /* there isn't one */
15541554
return;
15551555

1556+
if (!start) {
1557+
g->mlen = 0;
1558+
return;
1559+
}
1560+
15561561
/* turn it into a character string */
15571562
g->must = malloc((size_t)g->mlen + 1);
15581563
if (g->must == NULL) { /* argh; just forget it */

0 commit comments

Comments
 (0)