]> granicus.if.org Git - php/commitdiff
Fix memory source of string duplication for non internal properties
authorMarcus Boerger <helly@php.net>
Sun, 24 Aug 2003 18:47:11 +0000 (18:47 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 24 Aug 2003 18:47:11 +0000 (18:47 +0000)
Zend/zend_API.c

index 53f7d48219004823ab7c050f2f643f6cc414332a..2c111e4e509ef72ca14469b3fc6fa131ae668f29 100644 (file)
@@ -1708,11 +1708,12 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
        
        if (ce->type & ZEND_INTERNAL_CLASS) {
                property = malloc(sizeof(zval));
+               ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
        } else {
                ALLOC_ZVAL(property);
+               ZVAL_STRINGL(property, value, len, 1);
        }
        INIT_PZVAL(property);
-       ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
        return zend_declare_property(ce, name, name_length, property, access_type);
 }