Author: byterock
Date: Mon May 26 12:01:08 2008
New Revision: 11323

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/Makefile.PL
   dbd-oracle/trunk/Oraperl.pm
   dbd-oracle/trunk/dbdimp.c
   dbd-oracle/trunk/dbdimp.h
   dbd-oracle/trunk/oci8.c

Log:
added more copyright info and the fix for 
http://rt.cpan.org/Ticket/Display.html?id=32396

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes    (original)
+++ dbd-oracle/trunk/Changes    Mon May 26 12:01:08 2008
@@ -1,4 +1,5 @@
 =head1 Changes in DBD-Oracle 1.22(svn rev xxxx)  2008 
+  Fix for memory leak that snuck into 1.21 John Scoles
   Fix for rt.cpan.org Ticket #=36069: Problem with synonym from John Scoles
   Fix for rt.cpan.org Ticket #=28811 ORA_CHAR(s) not returning correct length 
in functions and procedures from John Scoles
   Makefile.PL now working without flags for Linux 11.1.0.6 instant client and 
regular client from John Scoles, Andy Sautins, H.Merijn Brand, Nathan Vonnahme 
and Karun Dutt

Modified: dbd-oracle/trunk/Makefile.PL
==============================================================================
--- dbd-oracle/trunk/Makefile.PL        (original)
+++ dbd-oracle/trunk/Makefile.PL        Mon May 26 12:01:08 2008
@@ -1,4 +1,6 @@
 ## Makefile.PL for DBD::Oracle - see README file for more information.
+# Copyright (c) 1994-2006 Tim Bunce. Ireland.
+# Copyright (c) 2006-2008 John Scoles (The Pythian Group). Canada.
 
 # vim: ts=8:sw=4
 

Modified: dbd-oracle/trunk/Oraperl.pm
==============================================================================
--- dbd-oracle/trunk/Oraperl.pm (original)
+++ dbd-oracle/trunk/Oraperl.pm Mon May 26 12:01:08 2008
@@ -868,6 +868,7 @@
 =head1 COPYRIGHT
 
 Copyright (c) 1994-2006 Tim Bunce. Ireland.
+Copyright (c) 2006-2008 John Scoles (The Pythian Group). Canada.
 
 The DBD::Oracle module is free open source software; you can
 redistribute it and/or modify it under the same terms as Perl 5.

Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c   (original)
+++ dbd-oracle/trunk/dbdimp.c   Mon May 26 12:01:08 2008
@@ -3,6 +3,7 @@
    dbdimp.c
 
    Copyright (c) 1994-2006  Tim Bunce  Ireland
+   Copyright (c) 2006-2008  John Scoles (The Pythian Group), Canada
 
    See the COPYRIGHT section in the Oracle.pm file for terms.
 
@@ -318,7 +319,7 @@
     Safefree(fb_ary->arcode);
     Safefree(fb_ary->cb_abuf);
     Safefree(fb_ary);
-   
+
 }
 
 
@@ -2185,7 +2186,7 @@
                if (imp_sth->ora_pad_empty)
                  croak("Can't use ora_pad_empty with bind_param_inout");
                if (SvTYPE(phs->sv)!=SVt_RV || !at_exec) {
-               
+
                        if (phs->ftype == 96){
                                SvGROW(phs->sv,(STRLEN) (unsigned 
int)phs->maxlen-1);
                        } else {
@@ -2197,10 +2198,10 @@
                      /* phs->sv _is_ the real live variable, it may 'mutate' 
later     */
                          /* pre-upgrade to high'ish type to reduce risk of 
SvPVX realloc/move */
                                SvGROW(phs->sv, (STRLEN)(((unsigned int) 
phs->maxlen <= min_len) ? min_len : (unsigned int) phs->maxlen)+1/*for null*/);
-               
+
                        }
                }
-         
+
     }
 
     /* At this point phs->sv must be at least a PV with a valid buffer,        
*/
@@ -2224,7 +2225,7 @@
 
     phs->sv_type = SvTYPE(phs->sv);    /* part of mutation check       */
     phs->maxlen  = ((IV)SvLEN(phs->sv)); /* avail buffer space (64bit safe) 
Logicaly maxlen should never change but it does why I know not*/
-       
+
     if (phs->maxlen < 0)               /* can happen with nulls        */
          phs->maxlen = 0;
 
@@ -3234,7 +3235,7 @@
                }
                if(len > (unsigned int) phs[i]->maxlen)
                    phs[i]->maxlen = len;
-     
+
                /* Do OCI bind calls on last iteration. */
                if( ((unsigned int) j ) == exe_count - 1 ) {
                    if(!do_bind_array_exec(sth, imp_sth, phs[i])) {

Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h   (original)
+++ dbd-oracle/trunk/dbdimp.h   Mon May 26 12:01:08 2008
@@ -1,5 +1,6 @@
 /*
    Copyright (c) 1994-2006 Tim Bunce
+   Copyright (c) 2006-2008 John Scoles (The Pythian Group), Canada
 
    See the COPYRIGHT section in the Oracle.pm file for terms.
 

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c     (original)
+++ dbd-oracle/trunk/oci8.c     Mon May 26 12:01:08 2008
@@ -3,6 +3,7 @@
    oci8.c
 
    Copyright (c) 1998-2006  Tim Bunce  Ireland
+   Copyright (c) 2006-2008 John Scoles (The Pythian Group), Canada
 
    See the COPYRIGHT section in the Oracle.pm file for terms.
 
@@ -2966,7 +2967,6 @@
     HV *lob_cols_hv = NULL;
     sword status;
     OCIError *errhp = imp_sth->errhp;
-    OCIDescribe  *dschp = NULL;
     OCIParam *parmhp = NULL, *collisthd = NULL, *colhd = NULL;
     ub2 numcols = 0;
     imp_fbh_t *fbh;
@@ -2994,15 +2994,21 @@
                return oci_error(sth, errhp, OCI_ERROR,
                "Unable to parse table name for LOB refetch");
 
-    OCIHandleAlloc_ok(imp_sth->envhp, &dschp, OCI_HTYPE_DESCRIBE, status);
+       if (!imp_sth->dschp){
+           OCIHandleAlloc_ok(imp_sth->envhp, &imp_sth->dschp, 
OCI_HTYPE_DESCRIBE, status);
+           if (status != OCI_SUCCESS) {
+                       oci_error(sth,imp_sth->errhp, status, "OCIHandleAlloc");
+               }
+
+        }
 
     OCIDescribeAny_log_stat(imp_sth->svchp, errhp, tablename, 
strlen(tablename),
-               (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_SYN, dschp, status);
+               (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_SYN, 
imp_sth->dschp, status);
     if (status == OCI_SUCCESS) { /* There is a synonym, get the schema */
        char *syn_schema=NULL, *syn_name=NULL;
        char new_tablename[100];
        ub4 syn_schema_len = 0, syn_name_len = 0,new_tablename_len=0;
-       OCIAttrGet_log_stat(dschp,  OCI_HTYPE_DESCRIBE,
+       OCIAttrGet_log_stat(imp_sth->dschp,  OCI_HTYPE_DESCRIBE,
                                  &parmhp, 0, OCI_ATTR_PARAM, errhp, status);
        OCIAttrGet_log_stat(parmhp, OCI_DTYPE_PARAM,
                          &syn_schema, &syn_schema_len, OCI_ATTR_SCHEMA_NAME, 
errhp, status);
@@ -3020,19 +3026,19 @@
     }
 
     OCIDescribeAny_log_stat(imp_sth->svchp, errhp, tablename, 
strlen(tablename),
-               (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_TABLE, dschp, 
status);
+               (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_TABLE, 
imp_sth->dschp, status);
        if (status != OCI_SUCCESS) {
       /* XXX this OCI_PTYPE_TABLE->OCI_PTYPE_VIEW fallback should actually be  
*/
       /* a loop that includes synonyms etc */
       OCIDescribeAny_log_stat(imp_sth->svchp, errhp, tablename, 
strlen(tablename),
-           (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_VIEW, dschp, status);
+           (ub1)OCI_OTYPE_NAME, (ub1)1, (ub1)OCI_PTYPE_VIEW, imp_sth->dschp, 
status);
        if (status != OCI_SUCCESS) {
-                       OCIHandleFree_log_stat(dschp, OCI_HTYPE_DESCRIBE, 
status);
+                       OCIHandleFree_log_stat(imp_sth->dschp, 
OCI_HTYPE_DESCRIBE, status);
                        return oci_error(sth, errhp, status, 
"OCIDescribeAny(view)/LOB refetch");
          }
     }
 
-    OCIAttrGet_log_stat(dschp,  OCI_HTYPE_DESCRIBE,
+    OCIAttrGet_log_stat(imp_sth->dschp,  OCI_HTYPE_DESCRIBE,
                                &parmhp, 0, OCI_ATTR_PARAM, errhp, status);
     if ( ! status ) {
            OCIAttrGet_log_stat(parmhp, OCI_DTYPE_PARAM,
@@ -3043,7 +3049,7 @@
                                &collisthd, 0, OCI_ATTR_LIST_COLUMNS, errhp, 
status);
     }
     if (status != OCI_SUCCESS) {
-               OCIHandleFree_log_stat(dschp, OCI_HTYPE_DESCRIBE, status);
+               OCIHandleFree_log_stat(imp_sth->dschp, OCI_HTYPE_DESCRIBE, 
status);
                return oci_error(sth, errhp, status, 
"OCIDescribeAny/OCIAttrGet/LOB refetch");
     }
 
@@ -3087,7 +3093,7 @@
                    if (status != OCI_SUCCESS) {
                                oci_error(sth, errhp, status,
                                    "OCIDescribeAny/OCIParamGet/OCIAttrGet/LOB 
refetch");
-                               OCIHandleFree_log_stat(dschp, 
OCI_HTYPE_DESCRIBE, status);
+                               OCIHandleFree_log_stat(imp_sth->dschp, 
OCI_HTYPE_DESCRIBE, status);
                                return 0;
                    }
                    if (!lob_cols_hv)

Reply via email to