Fixed potential use of un-initialized var (detected by Coverity)

This commit is contained in:
Ilia Alshanetsky 2006-10-12 01:05:09 +00:00
parent 24b2efa342
commit 8b8eb2cf88
2 changed files with 10 additions and 0 deletions

View File

@ -1553,6 +1553,11 @@ register struct re_guts *g;
if (g->mlen == 0) /* there isn't one */ if (g->mlen == 0) /* there isn't one */
return; return;
if (!start) {
g->mlen = 0;
return;
}
/* turn it into a character string */ /* turn it into a character string */
g->must = malloc((size_t)g->mlen + 1); g->must = malloc((size_t)g->mlen + 1);
if (g->must == NULL) { /* argh; just forget it */ if (g->must == NULL) { /* argh; just forget it */

View File

@ -1553,6 +1553,11 @@ register struct re_guts *g;
if (g->mlen == 0) /* there isn't one */ if (g->mlen == 0) /* there isn't one */
return; return;
if (!start) {
g->mlen = 0;
return;
}
/* turn it into a character string */ /* turn it into a character string */
g->must = malloc((size_t)g->mlen + 1); g->must = malloc((size_t)g->mlen + 1);
if (g->must == NULL) { /* argh; just forget it */ if (g->must == NULL) { /* argh; just forget it */