aboutsummaryrefslogtreecommitdiff
path: root/src/test8.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2008-02-13 18:25:27 +0000
committerdanielk1977 <danielk1977@noemail.net>2008-02-13 18:25:27 +0000
commita7a8e14bf2158f30674cbc182e964b20dc9b3b86 (patch)
treeb9987b03c14b3f04b30e6a24d0b718e2a67c42d1 /src/test8.c
parent0f35a6b529ba6ec6bcca1dc6c8cd80e5d062320a (diff)
downloadsqlite-a7a8e14bf2158f30674cbc182e964b20dc9b3b86.tar.gz
sqlite-a7a8e14bf2158f30674cbc182e964b20dc9b3b86.zip
Where possible, avoid freeing buffers allocated for vdbe memory cells in case they can be reused. (CVS 4783)
FossilOrigin-Name: 990237e27e417aff3dbf05784b716c21f3761a3a
Diffstat (limited to 'src/test8.c')
-rw-r--r--src/test8.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/test8.c b/src/test8.c
index 944ac686e..8c49571af 100644
--- a/src/test8.c
+++ b/src/test8.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.59 2008/01/22 21:30:53 drh Exp $
+** $Id: test8.c,v 1.60 2008/02/13 18:25:27 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -160,7 +160,12 @@ static int getColumnNames(
*/
nBytes = sizeof(char *) * nCol;
for(ii=0; ii<nCol; ii++){
- nBytes += (strlen(sqlite3_column_name(pStmt, ii)) + 1);
+ const char *zName = sqlite3_column_name(pStmt, ii);
+ if( !zName ){
+ rc = SQLITE_NOMEM;
+ goto out;
+ }
+ nBytes += strlen(zName)+1;
}
aCol = (char **)sqlite3MallocZero(nBytes);
if( !aCol ){
@@ -952,11 +957,15 @@ int echoUpdate(
if( bindArgOne ){
sqlite3_bind_value(pStmt, 1, apData[1]);
}
- for(i=2; i<nData; i++){
- if( apData[i] ) sqlite3_bind_value(pStmt, i, apData[i]);
+ for(i=2; i<nData && rc==SQLITE_OK; i++){
+ if( apData[i] ) rc = sqlite3_bind_value(pStmt, i, apData[i]);
+ }
+ if( rc==SQLITE_OK ){
+ sqlite3_step(pStmt);
+ rc = sqlite3_finalize(pStmt);
+ }else{
+ sqlite3_finalize(pStmt);
}
- sqlite3_step(pStmt);
- rc = sqlite3_finalize(pStmt);
}
if( pRowid && rc==SQLITE_OK ){