]> granicus.if.org Git - php/commitdiff
Fixed potential use of un-initialized var (detected by Coverity)
authorIlia Alshanetsky <iliaa@php.net>
Thu, 12 Oct 2006 01:05:09 +0000 (01:05 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 12 Oct 2006 01:05:09 +0000 (01:05 +0000)
ext/ereg/regex/regcomp.c
regex/regcomp.c

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