[svn:dbd-oracle] r14658 - dbd-oracle/trunk
[email protected] Thu, 27 Jan 2011 08:58:43 -0800 (PST)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: byterock
Date: Thu Jan 27 08:58:43 2011
New Revision: 14658
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/dbdimp.c
Log:
Fix for rt64524 Memory Leak when Oracle connection fails by Martin J. Evans
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Thu Jan 27 08:58:43 2011
@@ -1,6 +1,8 @@
=head1 Changes in DBD-Oracle 1.28 (svn rev 14583)
+ Fix for rt64524 Memory Leak when Oracle connection fails by Martin J. Evans
Add missing ora_drcp* values to dbh private_attribute_info by Martin J. Evans
+ Added all the missing ora_drcp values to dbh private_attribute_info by Martin J. Evans
Removed a load of attributes from sth private_attribute_info which are not handle attributes but attributes to bind_param/prepare by Martin J. Evans
Fix for rt 64244 - don't bail out, skip tests we cannot connect by Martin J. Evans and John Scoles
Added DBI to PREREQ_PM in Makefile.PL by Martin J. Evans
Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Thu Jan 27 08:58:43 2011
@@ -369,6 +369,7 @@
D_imp_drh_from_dbh;
ub2 new_charsetid = 0;
ub2 new_ncharsetid = 0;
+ int forced_new_environment = 0;
#if defined(USE_ITHREADS) && defined(PERL_MAGIC_shared_scalar)
SV ** shared_dbh_priv_svp ;
SV * shared_dbh_priv_sv ;
@@ -494,12 +495,14 @@
if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_envhp", 9)) && SvOK(*svp)) {
if (!SvTRUE(*svp)) {
imp_dbh->envhp = NULL; /* force new environment */
+ forced_new_environment = 1;
}
#if defined(CAN_USE_PRO_C)
else {
IV tmp;
if (!sv_isa(*svp, "ExtProc::OCIEnvHandle"))
croak("ora_envhp value is not of type ExtProc::OCIEnvHandle");
+ /* MJE cannot believe the following will work on 64bit platforms */
tmp = SvIV((SV*)SvRV(*svp));
imp_dbh->envhp = (struct OCIEnv *)tmp;
}
@@ -625,6 +628,9 @@
"OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.");
return 0;
}
+ if (!imp_drh->envhp) /* cache first envhp info drh as future default */
+ imp_drh->envhp = imp_dbh->envhp;
+
svp = DBD_ATTRIB_GET_SVP(attr, "ora_charset", 11);/*get the charset passed in by the user*/
if (svp) {
@@ -663,6 +669,8 @@
"OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc");
return 0;
}
+ if (!imp_drh->envhp) /* cache first envhp info drh as future default */
+ imp_drh->envhp = imp_dbh->envhp;
}
/* update the hard-coded csid constants for unicode charsets */
@@ -907,6 +915,8 @@
OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status);
OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR, status);
OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status);
+ if (forced_new_environment)
+ OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status);
return 0;
}