From 61ad95ad96a79b4806cf25fd42ca6af011ed18f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 28 Jun 2025 00:08:27 +0200 Subject: [PATCH 1/3] add test --- tests/gh-4-return-lob.phpt | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/gh-4-return-lob.phpt diff --git a/tests/gh-4-return-lob.phpt b/tests/gh-4-return-lob.phpt new file mode 100644 index 0000000..d1565a1 --- /dev/null +++ b/tests/gh-4-return-lob.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug GH-4 (Memory leak with long query/CLOB) with OCI_RETURN_LOBS +--EXTENSIONS-- +oci8 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ok From a9c1705033d634af48df23e4a8660fa18b52c43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 28 Jun 2025 00:09:45 +0200 Subject: [PATCH 2/3] fix Co-authored-by: SakiTakamachi --- oci8.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/oci8.c b/oci8.c index 96a6b29..0d59457 100644 --- a/oci8.c +++ b/oci8.c @@ -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); } if (column->data) { From 69338c2c3195e453878c85f4c20ebd80d6fae3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 1 Jul 2025 05:35:46 +0200 Subject: [PATCH 3/3] align with PR in php-src --- oci8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oci8.c b/oci8.c index 0d59457..15683c1 100644 --- a/oci8.c +++ b/oci8.c @@ -574,7 +574,7 @@ void php_oci_column_hash_dtor(zval *data) } if (column->descid && !GC_DELREF(column->descid)) { - zend_list_close(column->descid); + zend_list_free(column->descid); } if (column->data) {