[svn:dbd-oracle] r15464 - dbd-oracle/trunk

[email protected] Tue, 30 Oct 2012 17:09:57 -0700 (PDT)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Tue Oct 30 17:09:56 2012
New Revision: 15464

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/dbdimp.c

Log:
simple code clean up, replacing 3 uses of safemalloc with Newz 

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Tue Oct 30 17:09:56 2012
@@ -4,6 +4,8 @@
 
   [BUG FIXES]
   
+  - simple code clean up, replacing 3 uses of safemalloc with Newz (John Scoles)
+  
   - fix memory leak in execute_array (John Scoles, Pierre-Alain Blanc)
 
   - Fix RT80349 - The error message in execute_for_fetch when a row fails

Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c	(original)
+++ dbd-oracle/trunk/dbdimp.c	Tue Oct 30 17:09:56 2012
@@ -1411,7 +1411,7 @@
 	/* allocate room for copy of statement with spare capacity	*/
 	/* for editing '?' or ':1' into ':p1' so we can use obndrv.	*/
 	/* XXX should use SV and append to it */
-	imp_sth->statement = (char*)safemalloc(strlen(statement) * 10);
+	Newz(0,imp_sth->statement,strlen(statement) * 10,char);
 
 	/* initialise phs ready to be cloned per placeholder	*/
 	memset(&phs_tpl, 0, sizeof(phs_tpl));
@@ -3746,10 +3746,8 @@
 	Still ensures proper OCIBindByName*/
 
 	param_count=DBIc_NUM_PARAMS(imp_sth);
-	phs = safemalloc(param_count*sizeof(*phs));
-	utf8_flgs = safemalloc(param_count*sizeof(int));
-	memset(phs, 0, param_count*sizeof(*phs));
-	memset(utf8_flgs, 0, param_count*sizeof(int));
+	Newz(0,phs,param_count*sizeof(*phs),phs_t *);
+	Newz(0,utf8_flgs,param_count*sizeof(int),int);
 
 	for(j = 0; (unsigned int) j < exe_count; j++) {
 		/* Fill in 'unknown' exe count in every element (know not how to get
@@ -3838,8 +3836,6 @@
 			}
 		}
 	}
-	Safefree(phs);
-	Safefree(utf8_flgs);
 	/* Store array of bind typles, for use in OCIBindDynamic() callback. */
 	imp_sth->bind_tuples = tuples_av;
 	imp_sth->rowwise = (columns_av == NULL);