]> granicus.if.org Git - php/commitdiff
revert -r314422
authorXinchen Hui <laruence@php.net>
Sun, 7 Aug 2011 14:25:30 +0000 (14:25 +0000)
committerXinchen Hui <laruence@php.net>
Sun, 7 Aug 2011 14:25:30 +0000 (14:25 +0000)
No need to check erealloc's return

ext/standard/basic_functions.c

index cce6880338aef11a245f4f6e98277fa23b03e46b..ba83eb38d8734b2f6e07c0e4bdb15df22624dc0f 100644 (file)
@@ -4252,15 +4252,15 @@ PHP_FUNCTION(getopt)
                /* the first <len> slots are filled by the one short ops
                 * we now extend our array and jump to the new added structs */
                opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len + count + 1));
-               if (!opts) {
-                       RETURN_FALSE;
-               }
-
                orig_opts = opts;
                opts += len;
 
                memset(opts, 0, count * sizeof(opt_struct));
 
+               if (!opts) {
+                       RETURN_FALSE;
+               }
+
                /* Reset the array indexes. */
                zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));
 
@@ -4297,10 +4297,6 @@ PHP_FUNCTION(getopt)
                }
        } else {
                opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1));
-               if (!opts) {
-                       RETURN_FALSE;
-               }
-
                orig_opts = opts;
                opts += len;
        }