Skip to content

ext/oci8: Fix GH-18873 - Free column->descid appropriately #18957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Decrease the reference count before calling zend_list_close()
  • Loading branch information
SakiTakamachi committed Jun 27, 2025
commit 62b76bf39e3e7bf9622a00d66ca7aca9fe2404d1
8 changes: 2 additions & 6 deletions ext/oci8/oci8.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,8 @@ void php_oci_column_hash_dtor(zval *data)
zend_list_close(column->stmtid);
}

if (column->descid) {
if (GC_REFCOUNT(column->descid) == 1)
zend_list_close(column->descid);
else {
GC_DELREF(column->descid);
}
if (column->descid && !GC_DELREF(column->descid)) {
zend_list_close(column->descid);
Copy link
Member

Choose a reason for hiding this comment

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

It seems that the original code wanted to call zend_list_delete instead of zend_list_close.
Your fix is fine, but can be improved further by using zend_list_free instead of zend_list_close as we already know the refcount is 0.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

That code is different.

}

if (column->data) {
Expand Down
Loading