summaryrefslogtreecommitdiff
path: root/src/test2.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2012-09-20 18:34:42 -0400
committerHans-Christoph Steiner <hans@eds.org>2012-09-20 18:34:42 -0400
commit734b4f890763e4efafe865ba476c43cc8d1a2214 (patch)
treed561d2fad0788619f4b8e230073f6af1d416934e /src/test2.c
parent396b08286e7bb56e0e6440aaf1345c18e72ee22e (diff)
parent487e15dc239ccdb3344d1c99ce120e872bab4a74 (diff)
Merge tag 'upstream/2.0.6'
Upstream version 2.0.6
Diffstat (limited to 'src/test2.c')
-rw-r--r--src/test2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test2.c b/src/test2.c
index fa7dd76..8acdf6f 100644
--- a/src/test2.c
+++ b/src/test2.c
@@ -537,6 +537,8 @@ static int fake_big_file(
int rc;
int n;
i64 offset;
+ char *zFile;
+ int nFile;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" N-MEGABYTES FILE\"", 0);
@@ -545,17 +547,24 @@ static int fake_big_file(
if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
pVfs = sqlite3_vfs_find(0);
- rc = sqlite3OsOpenMalloc(pVfs, argv[2], &fd,
+ nFile = (int)strlen(argv[2]);
+ zFile = sqlite3_malloc( nFile+2 );
+ if( zFile==0 ) return TCL_ERROR;
+ memcpy(zFile, argv[2], nFile+1);
+ zFile[nFile+1] = 0;
+ rc = sqlite3OsOpenMalloc(pVfs, zFile, &fd,
(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB), 0
);
if( rc ){
Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0);
+ sqlite3_free(zFile);
return TCL_ERROR;
}
offset = n;
offset *= 1024*1024;
rc = sqlite3OsWrite(fd, "Hello, World!", 14, offset);
sqlite3OsCloseFree(fd);
+ sqlite3_free(zFile);
if( rc ){
Tcl_AppendResult(interp, "write failed: ", errorName(rc), 0);
return TCL_ERROR;