1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Make sure the zTail return from sqlite3_prepare() is initialized even

if there is a malloc failure. (CVS 4963)

FossilOrigin-Name: 040cffe2727936ce9228666fce5b00db47493e7d
This commit is contained in:
drh
2008-04-03 21:42:21 +00:00
parent 75e99a4727
commit 4b1d66c1ec
3 changed files with 9 additions and 9 deletions

View File

@@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.139 2008/03/20 14:03:29 drh Exp $
** $Id: tokenize.c,v 1.140 2008/04/03 21:42:21 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -394,6 +394,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
db->u1.isInterrupted = 0;
}
pParse->rc = SQLITE_OK;
pParse->zTail = pParse->zSql = zSql;
i = 0;
pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3_malloc);
if( pEngine==0 ){
@@ -407,7 +408,6 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
assert( pParse->nVarExpr==0 );
assert( pParse->nVarExprAlloc==0 );
assert( pParse->apVarExpr==0 );
pParse->zTail = pParse->zSql = zSql;
while( !db->mallocFailed && zSql[i]!=0 ){
assert( i>=0 );
pParse->sLastToken.z = (u8*)&zSql[i];