]> granicus.if.org Git - php/commitdiff
MFH: fix leak (init array only if we got valid start key)
authorAntony Dovgal <tony2001@php.net>
Thu, 16 Dec 2004 19:20:54 +0000 (19:20 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 16 Dec 2004 19:20:54 +0000 (19:20 +0000)
ext/standard/array.c

index 5ea2f23549a77ed9f6413d763fc4baaabed1d2fb..efe26cdec6252c6d7635c85152167525898a8b39 100644 (file)
@@ -1487,13 +1487,13 @@ PHP_FUNCTION(array_fill)
                WRONG_PARAM_COUNT;
        }
 
-       /* allocate an array for return */
-       array_init(return_value);
-
        switch (Z_TYPE_PP(start_key)) {
                case IS_STRING:
                case IS_LONG:
                case IS_DOUBLE:
+                       /* allocate an array for return */
+                       array_init(return_value);
+
                        if (PZVAL_IS_REF(*val)) {
                                SEPARATE_ZVAL(val);
                        }