1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Test cases and corrections to IO and malloc() error handling in incremental blob IO functions. (CVS 3915)

FossilOrigin-Name: 641e55284e1ba6070073c83ac6ed78ffb29f7e60
This commit is contained in:
danielk1977
2007-05-04 12:05:56 +00:00
parent 126afe6b59
commit 92d4d7a92e
8 changed files with 277 additions and 71 deletions

View File

@@ -12,7 +12,7 @@
** A TCL Interface to SQLite. Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
** $Id: tclsqlite.c,v 1.182 2007/05/03 16:31:26 danielk1977 Exp $
** $Id: tclsqlite.c,v 1.183 2007/05/04 12:05:56 danielk1977 Exp $
*/
#include "tcl.h"
#include <errno.h>
@@ -153,7 +153,8 @@ static void closeIncrblobChannels(SqliteDb *pDb){
*/
static int incrblobClose(ClientData instanceData, Tcl_Interp *interp){
IncrblobChannel *p = (IncrblobChannel *)instanceData;
sqlite3_blob_close(p->pBlob);
int rc = sqlite3_blob_close(p->pBlob);
sqlite3 *db = p->pDb->db;
/* Remove the channel from the SqliteDb.pIncrblob list. */
if( p->pNext ){
@@ -166,7 +167,13 @@ static int incrblobClose(ClientData instanceData, Tcl_Interp *interp){
p->pDb->pIncrblob = p->pNext;
}
/* Free the IncrblobChannel structure */
Tcl_Free((char *)p);
if( rc!=SQLITE_OK ){
Tcl_SetResult(interp, (char *)sqlite3_errmsg(db), TCL_VOLATILE);
return TCL_ERROR;
}
return TCL_OK;
}