fix valgrind errors
authorMichael Wallner <mike@php.net>
Fri, 13 Apr 2012 11:17:03 +0000 (11:17 +0000)
committerMichael Wallner <mike@php.net>
Fri, 13 Apr 2012 11:17:03 +0000 (11:17 +0000)
php_http_property_proxy.c

index 4ec80addee83b203884e988f7a392c45039a7027..f4d352300cee50da02405c5ece530d0f3f568600 100644 (file)
@@ -135,6 +135,7 @@ static zval *php_http_property_proxy_object_get(zval *object TSRMLS_DC)
                        MAKE_STD_ZVAL(unset);
                        ZVAL_NULL(unset);
                        zend_symtable_update(Z_ARRVAL_P(obj->proxy->object), Z_STRVAL_P(obj->proxy->member), Z_STRLEN_P(obj->proxy->member)+1, (void *) &unset, sizeof(zval *), (void *) &data);
+                       Z_ADDREF_PP(data);
                }
 
                return *data;
@@ -151,10 +152,10 @@ static void php_http_property_proxy_object_set(zval **object, zval *value TSRMLS
 #if PHP_HTTP_PPDBG
        fprintf(stderr, "proxy_set: %s\n", Z_STRVAL_P(obj->proxy->member));
 #endif
+       Z_ADDREF_P(value);
        if (Z_TYPE_P(target) == IS_OBJECT) {
                zend_update_property(Z_OBJCE_P(target), target, Z_STRVAL_P(obj->proxy->member), Z_STRLEN_P(obj->proxy->member), value TSRMLS_CC);
        } else {
-               Z_ADDREF_P(value);
                zend_symtable_update(Z_ARRVAL_P(target), Z_STRVAL_P(obj->proxy->member), Z_STRLEN_P(obj->proxy->member)+1, (void *) &value, sizeof(zval *), NULL);
        }
        /* propagate */