From: Antony Dovgal Date: Tue, 17 Apr 2007 17:00:16 +0000 (+0000) Subject: fix leaks in row_get_properties() X-Git-Tag: php-5.2.2RC2~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ab23a7e53d5efc1417a8b71acff8666fe6b31a0;p=php fix leaks in row_get_properties() thanks to Kellen Bombardier for noticing --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 658d99ee62..13170a3034 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2525,28 +2525,18 @@ static void row_prop_or_dim_delete(zval *object, zval *offset TSRMLS_DC) static HashTable *row_get_properties(zval *object TSRMLS_DC) { - zval *tmp; pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC); int i; - HashTable *ht; - - MAKE_STD_ZVAL(tmp); - array_init(tmp); for (i = 0; i < stmt->column_count; i++) { zval *val; MAKE_STD_ZVAL(val); fetch_value(stmt, val, i, NULL TSRMLS_CC); - add_assoc_zval(tmp, stmt->columns[i].name, val); + zend_hash_update(stmt->properties, stmt->columns[i].name, stmt->columns[i].namelen + 1, (void *)&val, sizeof(zval *), NULL); } - ht = Z_ARRVAL_P(tmp); - - ZVAL_NULL(tmp); - FREE_ZVAL(tmp); - - return ht; + return stmt->properties; } static union _zend_function *row_method_get(