Author: byterock
Date: Fri Feb 22 15:08:07 2008
New Revision: 10822
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/oci8.c
Log:
Fixed memory leak (not releasing Temp Lob with OCILobFreeTemporary) when
created for a bind John Scoles
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Fri Feb 22 15:08:07 2008
@@ -1,5 +1,6 @@
=head1 Changes in DBD-Oracle 1.21(svn rev xxxx)
+ Fixed memory leak (not releasing Temp Lob with OCILobFreeTemporary) when
created for a bind John Scoles
Added suppot for bind_param_inout_array with use with execute_array from
John Scoles
Added enhancement for Embedded Objects handling from Paul G. Weiss
Fixed to Makefile.PL let it read makefiles from other makes from Alexander V
Alekseev
Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Fri Feb 22 15:08:07 2008
@@ -733,7 +733,7 @@
{
dTHX;
if (pre_exec)
- return 1;
+ return 1;
/* fetch PL/SQL LOB data */
if (imp_sth->auto_lob && (
imp_sth->stmt_type == OCI_STMT_BEGIN || imp_sth->stmt_type ==
OCI_STMT_DECLARE )) {
@@ -808,12 +808,11 @@
if (amtp > 0) {
ub1 lobtype = (phs->ftype == 112 ? OCI_TEMP_CLOB : OCI_TEMP_BLOB);
-
OCILobCreateTemporary_log_stat(imp_dbh->svchp, imp_sth->errhp,
(OCILobLocator *) phs->desc_h, (ub2) OCI_DEFAULT,
(ub1) OCI_DEFAULT, lobtype, TRUE, OCI_DURATION_SESSION, status);
- if (status != OCI_SUCCESS) {
+ if (status != OCI_SUCCESS) {
oci_error(sth, imp_sth->errhp, status, "OCILobCreateTemporary");
return 0;
}
@@ -2927,25 +2926,38 @@
if (!imp_sth->auto_lob)
return 1; /* application doesn't want magical lob handling */
-
- if (imp_sth->stmt_type == OCI_STMT_BEGIN || imp_sth->stmt_type ==
OCI_STMT_DECLARE)
- return 1; /* PL/SQL is handled by lob_phs_post_execute */
+ if (imp_sth->stmt_type == OCI_STMT_BEGIN || imp_sth->stmt_type ==
OCI_STMT_DECLARE){
+ /* PL/SQL is handled by lob_phs_ora_free_templobpost_execute */
+ if (imp_sth->has_lobs) { /*get rid of OCILob Temporary used in
non inout bind*/
+ SV *phs_svp;
+ I32 i;
+ char *p;
+ hv_iterinit(imp_sth->all_params_hv);
+ while( (phs_svp = hv_iternextsv(imp_sth->all_params_hv,
&p, &i)) != NULL ) {
+ phs_t *phs = (phs_t*)(void*)SvPVX(phs_svp);
+ if (phs->desc_h && !phs->is_inout){
+ (sth, imp_sth, phs->desc_h);
+ }
+ }
+ }
+ return 1;
+ }
if (row_count == 0)
- return 1; /* nothing to do */
+ return 1; /* nothing to do */
if (row_count > 1)
- return oci_error(sth, errhp, OCI_ERROR, "LOB refetch attempted for
multiple rows");
+ return oci_error(sth, errhp, OCI_ERROR, "LOB refetch attempted
for multiple rows");
if (!imp_sth->lob_refetch) {
- if (!init_lob_refetch(sth, imp_sth))
- return 0; /* init_lob_refetch already called oci_error */
+ if (!init_lob_refetch(sth, imp_sth))
+ return 0; /* init_lob_refetch already called oci_error */
}
lr = imp_sth->lob_refetch;
OCIAttrGet_stmhp_stat(imp_sth, lr->rowid, 0, OCI_ATTR_ROWID,
status);
if (status != OCI_SUCCESS)
- return oci_error(sth, errhp, status, "OCIAttrGet OCI_ATTR_ROWID /LOB
refetch");
+ return oci_error(sth, errhp, status, "OCIAttrGet OCI_ATTR_ROWID
/LOB refetch");