diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/shell.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/shell.c b/src/shell.c index 9f297c4df..68835723a 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.209 2009/05/21 15:15:01 drh Exp $ +** $Id: shell.c,v 1.210 2009/05/31 17:16:10 drh Exp $ */ #if defined(_WIN32) || defined(WIN32) /* This needs to come before any includes for MSVC compiler */ @@ -623,8 +623,15 @@ static void multireplace( } } if( (nOut+nCopy)>nMalloc ){ + char *zNew; nMalloc = 16 + (nOut+nCopy)*2; - zOut = (char *)sqlite3_realloc(zOut, nMalloc); + zNew = (char*)sqlite3_realloc(zOut, nMalloc); + if( zNew==0 ){ + sqlite3_result_error_nomem(context); + return; + }else{ + zOut = zNew; + } } assert( nMalloc>=(nOut+nCopy) ); memcpy(&zOut[nOut], zCopy, nCopy); |