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

index 4368f2d91ff51c3789c6fc74680ba369cfc85815..587fc92b163abb4003b44727060d1d8fd6ac1fdc 100644 (file)
@@ -1519,13 +1519,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);
                        }