aboutsummaryrefslogtreecommitdiff
path: root/src/func.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-08-23 02:47:53 +0000
committerdrh <drh@noemail.net>2007-08-23 02:47:53 +0000
commit4a50aac5645b7dffed2c27e552675fa4be3a9368 (patch)
tree8a197bbd8fca21cf558ae84e510efd8168fe72c2 /src/func.c
parented138fb3bc8e55a6ae93669899dce79e5e26c65a (diff)
downloadsqlite-4a50aac5645b7dffed2c27e552675fa4be3a9368.tar.gz
sqlite-4a50aac5645b7dffed2c27e552675fa4be3a9368.zip
Improvements to memory leak detection. The --backtrace=NNN option is now
recognized by tester.tcl. Memory leak summaries are automatically written to the file ./memleak.txt and each leak is tagged with the test in which it occurred. The quick.test script runs on Linux with no errors and no leaks. (CVS 4273) FossilOrigin-Name: 21f6b31097692171c6493e6ca6de6acbd62dc595
Diffstat (limited to 'src/func.c')
-rw-r--r--src/func.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/func.c b/src/func.c
index 224f88f08..7b981df30 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.168 2007/08/21 19:33:56 drh Exp $
+** $Id: func.c,v 1.169 2007/08/23 02:47:53 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -807,14 +807,17 @@ static void replaceFunc(
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
+ u8 *zOld;
nOut += nRep - nPattern;
if( nOut>=SQLITE_MAX_LENGTH ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
+ zOld = zOut;
zOut = sqlite3_realloc(zOut, (int)nOut);
if( zOut==0 ){
+ sqlite3_free(zOld);
return;
}
memcpy(&zOut[j], zRep, nRep);