Out-of-memory checks added to tclsqlite.c and shell.c. Tickets #1805 and #1806. (CVS 3182)

FossilOrigin-Name: 364031d6e512b992a7147bbc8e046c20c0c5335a
This commit is contained in:
drh 2006-05-10 14:39:13 +00:00
parent f3a5888dde
commit c1f4494e65
4 changed files with 21 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Fix\serror\sprocessing\sin\sLemon.\s\sSQLite\sdoes\snot\suse\sthis\sfeature\sof\slemon\nso\sit\sis\suneffected.\s(CVS\s3181)
D 2006-05-08T15:14:19
C Out-of-memory\schecks\sadded\sto\stclsqlite.c\sand\sshell.c.\s\sTickets\s#1805\sand\s#1806.\s(CVS\s3182)
D 2006-05-10T14:39:14
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -68,11 +68,11 @@ F src/printf.c 358b4b585270f92a228e646e7bbb261c65f2a166
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c 8daba07a04a6d41f5267ea8353324cbe5a210e14
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 5cce3dabcad1f61fa80f8cbcd29bcb5776bda585
F src/shell.c 1862fab6f7cfe80749b21eb7d6d3195585461a83
F src/sqlite.h.in e783b895fe2fcd68f6c04408a4efaef58cd1cdda
F src/sqliteInt.h 9052a26e0467be0ac0c554fb1f8de671eda2ea0d
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
F src/tclsqlite.c d20bdf1822c47e367f5acd37823ffe67df40301c
F src/tclsqlite.c 5ae9f08f7af7fe80d38fbccc4f5359f272643af1
F src/test1.c becd9202b733debc607b5aec43002769730e1f71
F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b
F src/test3.c 86e99724ee898b119ed575ef9f98618afe7e5e5d
@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P ef8e9886f40c8528604264308f5e4734ae6706c5
R 7371efdf26683a66acd98a01f6ba8973
P 864cac960390a31c240d34ffd62bb084ab780267
R fd698bfdf84969615fcfbfaf72ad31c9
U drh
Z 3b1eb8279fc00d23e86479f81bdf405c
Z e750a9d73cf64d5d55602faaba0f7878

View File

@ -1 +1 @@
864cac960390a31c240d34ffd62bb084ab780267
364031d6e512b992a7147bbc8e046c20c0c5335a

View File

@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.135 2006/03/19 13:00:25 drh Exp $
** $Id: shell.c,v 1.136 2006/05/10 14:39:14 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
@ -1471,6 +1471,10 @@ static void process_input(struct callback_data *p, FILE *in){
if( zLine[i]!=0 ){
nSql = strlen(zLine);
zSql = malloc( nSql+1 );
if( zSql==0 ){
fprintf(stderr, "out of memory\n");
exit(1);
}
strcpy(zSql, zLine);
}
}else{

View File

@ -11,7 +11,7 @@
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.155 2006/03/16 16:19:56 drh Exp $
** $Id: tclsqlite.c,v 1.156 2006/05/10 14:39:14 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@ -1108,11 +1108,13 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
if( i+1!=nCol ){
char *zErr;
zErr = malloc(200 + strlen(zFile));
sprintf(zErr,
"Error: %s line %d: expected %d columns of data but found %d",
zFile, lineno, nCol, i+1);
Tcl_AppendResult(interp, zErr, 0);
free(zErr);
if( zErr ){
sprintf(zErr,
"Error: %s line %d: expected %d columns of data but found %d",
zFile, lineno, nCol, i+1);
Tcl_AppendResult(interp, zErr, 0);
free(zErr);
}
zCommit = "ROLLBACK";
break;
}