summaryrefslogtreecommitdiff
path: root/ext/oci8/oci8_lob.c
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2008-01-15 20:44:31 +0000
committerChristopher Jones <sixd@php.net>2008-01-15 20:44:31 +0000
commited50a373b1c7d25afa6d71457d14708791ef0d40 (patch)
tree9feeda2fe422344d3bd1cc9fac088ee2dca50a9a /ext/oci8/oci8_lob.c
parent05534af71ba3dc775c04a68153414644af7cd1b8 (diff)
downloadphp-git-ed50a373b1c7d25afa6d71457d14708791ef0d40.tar.gz
MFB: fix #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
Diffstat (limited to 'ext/oci8/oci8_lob.c')
-rw-r--r--ext/oci8/oci8_lob.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 24c7985011..2c0dc84342 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -570,7 +570,6 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
- int is_temporary;
PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
@@ -579,7 +578,21 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+
+ if (php_oci_temp_lob_close(descriptor)) {
+ return 1;
+ }
+ return 0;
+} /* }}} */
+
+/* {{{ php_oci_temp_lob_close()
+ Close Temporary LOB */
+int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
+{
+ php_oci_connection *connection = descriptor->connection;
+ int is_temporary;
+
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
if (connection->errcode != OCI_SUCCESS) {
@@ -589,7 +602,6 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
}
if (is_temporary) {
-
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
@@ -601,6 +613,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
return 0;
} /* }}} */
+
/* {{{ php_oci_lob_flush()
Flush buffers for the LOB (only if they have been used) */
int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
@@ -647,7 +660,6 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
Close LOB descriptor and free associated resources */
void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
{
-
if (!descriptor || !descriptor->connection) {
return;
}
@@ -662,6 +674,12 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
}
+#ifdef HAVE_OCI8_TEMP_LOB
+ if (descriptor->type == OCI_DTYPE_LOB) {
+ php_oci_temp_lob_close(descriptor);
+ }
+#endif
+
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
zend_list_delete(descriptor->connection->rsrc_id);