]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Never user a pointer to standard library routines malloc() and free().
authordrh <drh@noemail.net>
Sun, 22 May 2005 20:12:37 +0000 (20:12 +0000)
committerdrh <drh@noemail.net>
Sun, 22 May 2005 20:12:37 +0000 (20:12 +0000)
This rule is to
work around limitations of MSVC and the _fastcall calling convention.
Ticket #1256. (CVS 2473)

FossilOrigin-Name: a39c446726099e4915a1ad72c019d3c2cfe065bb

manifest
manifest.uuid
src/sqliteInt.h
src/tokenize.c
src/util.c

index 72707ea86092528bd629f0b9393d0490ac800eed..0bdc945000a5532dc65f8d4a44e5d13559d5ff13 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\smemory\sleak.\s\sTicket\s#1259.\s(CVS\s2472)
-D 2005-05-22T19:21:52
+C Never\suser\sa\spointer\sto\sstandard\slibrary\sroutines\smalloc()\sand\sfree().\r\nThis\srule\sis\sto\r\nwork\saround\slimitations\sof\sMSVC\sand\sthe\s_fastcall\scalling\sconvention.\r\nTicket\s#1256.\s(CVS\s2473)
+D 2005-05-22T20:12:37
 F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -61,7 +61,7 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
 F src/select.c 43cc2a76e3e00dabc59da82d0dcdef23cdba43a3
 F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
 F src/sqlite.h.in 3675e3ada207e09b9d52a0463561325df4ac26b5
-F src/sqliteInt.h d4faaa3ce498d788eff39325419a97f9d894f538
+F src/sqliteInt.h b158733d7fd434e587b1d16f1ed0bb704a74601c
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9
 F src/test1.c 4ad7ffe5a74fd99d4f73f6fd28ba27f403b3adba
@@ -69,11 +69,11 @@ F src/test2.c 7f0ef466706ac01414e1136b96e5d8a65cb97545
 F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0
 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
 F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
-F src/tokenize.c 103cbaa932c790f540f8eceb63cd3010e117bdff
+F src/tokenize.c fbe48ad208263b7c493fe16e29a293e6d47b451a
 F src/trigger.c 1a6d0c7c51b70bdc58d5068be72034071eff23ad
 F src/update.c 04ea9dd784ccfeaf38a681b3edfe3b1c4edfdda7
 F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
-F src/util.c ac74ac096cbe61fe0139f041833a47c97a2dec07
+F src/util.c 1e1402e7115d0a81f92f43be50a2198c85fced5f
 F src/vacuum.c bc1b36a56d0b4d86e1ed783cbdb24c5a54702e58
 F src/vdbe.c d2574042c44baf6b1016c61e8072dec529ac748a
 F src/vdbe.h 75e466d84d362b0c4498978a9d6b1e6bd32ecf3b
@@ -279,7 +279,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P 20bd303e8c6f7e69ba82ce1dc3041ea4e02d55cf
-R 2b16f203bf20f4336c2f28ec0b8afc16
+P 254ac2213e695ead065ba3807d5d285046212fe1
+R d1ea6d9ebc828607ed9bd32c6c8038d0
 U drh
-Z 3a398f7449d7f6fee62866b5b69f1ae6
+Z 3ea66755830174fb2ac88e49c4d8b8fd
index 2bdda2707893f81480618148964a11dfa2677175..221a6dc93937dda580b4ede82c1e827f2c2ae9f4 100644 (file)
@@ -1 +1 @@
-254ac2213e695ead065ba3807d5d285046212fe1
\ No newline at end of file
+a39c446726099e4915a1ad72c019d3c2cfe065bb
\ No newline at end of file
index 47138f52e98ab6fafc217618d4660cf682d54258..334526ecb62d37a9364d1d9057e74f2c69b82a9c 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.379 2005/05/21 02:48:09 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.380 2005/05/22 20:12:37 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -1345,8 +1345,10 @@ void sqlite3RealToSortable(double r, char *);
   char *sqlite3StrDup(const char*);
   char *sqlite3StrNDup(const char*, int);
 # define sqlite3CheckMemory(a,b)
+# define sqlite3MallocX sqlite3Malloc
 #endif
 void sqlite3FreeX(void*);
+void *sqlite3MallocX(int);
 char *sqlite3MPrintf(const char*, ...);
 char *sqlite3VMPrintf(const char*, va_list);
 void sqlite3DebugPrintf(const char*, ...);
index 1c3d1994918963c8e016038674dcee3501823ee1..ddeb2412f2590d9425e3cd8844238b247c0b1da3 100644 (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.101 2005/02/26 17:31:27 drh Exp $
+** $Id: tokenize.c,v 1.102 2005/05/22 20:12:37 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -341,7 +341,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
   db->flags &= ~SQLITE_Interrupt;
   pParse->rc = SQLITE_OK;
   i = 0;
-  pEngine = sqlite3ParserAlloc((void*(*)(int))malloc);
+  pEngine = sqlite3ParserAlloc((void*(*)(int))sqlite3MallocX);
   if( pEngine==0 ){
     sqlite3SetString(pzErrMsg, "out of memory", (char*)0);
     return 1;
@@ -401,7 +401,7 @@ abort_parse:
     }
     sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
   }
-  sqlite3ParserFree(pEngine, free);
+  sqlite3ParserFree(pEngine, sqlite3FreeX);
   if( sqlite3_malloc_failed ){
     pParse->rc = SQLITE_NOMEM;
   }
index fc16141516e04452288b6e550f64d0c48eadbe6c..23409c4ad8f3341de7581e8d2cbf691a1a387c6b 100644 (file)
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.133 2005/05/03 12:30:34 drh Exp $
+** $Id: util.c,v 1.134 2005/05/22 20:12:37 drh Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -112,6 +112,13 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){
   return p;
 }
 
+/*
+** This version of malloc is always a real function, never a macro
+*/
+void *sqlite3MallocX(int n){
+  return sqlite3Malloc_(n, 0, __FILE__, __LINE__);
+}
+
 /*
 ** Check to see if the given pointer was obtained from sqliteMalloc()
 ** and is able to hold at least N bytes.  Raise an exception if this