]> granicus.if.org Git - php/commitdiff
Fix PdoRow leak
authorNikita Popov <nikic@php.net>
Thu, 16 Apr 2015 16:04:09 +0000 (18:04 +0200)
committerNikita Popov <nikic@php.net>
Thu, 16 Apr 2015 19:08:29 +0000 (21:08 +0200)
PdoStatement should only hold a weakref to the PdoRow.

ext/pdo/pdo_stmt.c

index 346aba7eb0f88bdb2477cfaf1551a6a4349b2a1a..be22a0e71ecfb697a2445a5fb5604e3ecdb1b650 100644 (file)
@@ -262,7 +262,8 @@ static void get_lazy_object(pdo_stmt_t *stmt, zval *return_value) /* {{{ */
                zend_object_std_init(&row->std, pdo_row_ce);
                ZVAL_OBJ(&stmt->lazy_object_ref, &row->std);
                row->std.handlers = &pdo_row_object_handlers;
-               stmt->std.gc.refcount++;
+               GC_REFCOUNT(&stmt->std)++;
+               GC_REFCOUNT(&row->std)--;
        }
        ZVAL_COPY(return_value, &stmt->lazy_object_ref);
 }