Never user a pointer to standard library routines malloc() and free().
This rule is to
work around limitations of MSVC and the _fastcall calling convention.
Ticket #1256. (CVS 2473)

FossilOrigin-Name: a39c446726099e4915a1ad72c019d3c2cfe065bb
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 47138f5..334526e 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -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 @@
   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*, ...);
diff --git a/src/tokenize.c b/src/tokenize.c
index 1c3d199..ddeb241 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -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 @@
   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 @@
     }
     sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
   }
-  sqlite3ParserFree(pEngine, free);
+  sqlite3ParserFree(pEngine, sqlite3FreeX);
   if( sqlite3_malloc_failed ){
     pParse->rc = SQLITE_NOMEM;
   }
diff --git a/src/util.c b/src/util.c
index fc16141..23409c4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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>
@@ -113,6 +113,13 @@
 }
 
 /*
+** 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
 ** is not the case.