Skip to content

Commit

Permalink
Add missing NULL checks in dbstmt_get_gc
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdos committed Feb 1, 2025
1 parent f1702d2 commit e306a2e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1965,9 +1965,13 @@ static HashTable *dbstmt_get_gc(zend_object *object, zval **gc_data, int *gc_cou
enum pdo_fetch_type default_fetch_mode = stmt->default_fetch_type & ~PDO_FETCH_FLAGS;

zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create();
zend_get_gc_buffer_add_obj(gc_buffer, stmt->database_object_handle);
if (stmt->database_object_handle) {
zend_get_gc_buffer_add_obj(gc_buffer, stmt->database_object_handle);
}
if (default_fetch_mode == PDO_FETCH_INTO) {
zend_get_gc_buffer_add_obj(gc_buffer, stmt->fetch.into);
if (stmt->fetch.into) {
zend_get_gc_buffer_add_obj(gc_buffer, stmt->fetch.into);
}
} else if (default_fetch_mode == PDO_FETCH_CLASS && stmt->fetch.cls.ctor_args != NULL) {
zend_get_gc_buffer_add_ht(gc_buffer, stmt->fetch.cls.ctor_args);
}
Expand Down

1 comment on commit e306a2e

@Girgias
Copy link
Member

@Girgias Girgias commented on e306a2e Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please # to comment.