]> 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:23:59 +0000 (19:23 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 16 Dec 2004 19:23:59 +0000 (19:23 +0000)
ext/standard/array.c

index 0a6aaed0179e646d2dd9e3473deaaf4f5c093f48..6b8798d0eb9e2ec57e957818c21f5cfb41d12b22 100644 (file)
@@ -1391,13 +1391,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);
                        }