mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-10-30 07:05:46 +03:00 
			
		
		
		
	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
This commit is contained in:
		
							
								
								
									
										16
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								manifest
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| C Fix\sa\smemory\sleak.\s\sTicket\s#1259.\s(CVS\s2472) | 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-22T19:21:52 | D 2005-05-22T20:12:37 | ||||||
| F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3 | F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3 | ||||||
| F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 | F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 | ||||||
| F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 | F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 | ||||||
| @@ -61,7 +61,7 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 | |||||||
| F src/select.c 43cc2a76e3e00dabc59da82d0dcdef23cdba43a3 | F src/select.c 43cc2a76e3e00dabc59da82d0dcdef23cdba43a3 | ||||||
| F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26 | F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26 | ||||||
| F src/sqlite.h.in 3675e3ada207e09b9d52a0463561325df4ac26b5 | F src/sqlite.h.in 3675e3ada207e09b9d52a0463561325df4ac26b5 | ||||||
| F src/sqliteInt.h d4faaa3ce498d788eff39325419a97f9d894f538 | F src/sqliteInt.h b158733d7fd434e587b1d16f1ed0bb704a74601c | ||||||
| F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 | F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 | ||||||
| F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9 | F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9 | ||||||
| F src/test1.c 4ad7ffe5a74fd99d4f73f6fd28ba27f403b3adba | F src/test1.c 4ad7ffe5a74fd99d4f73f6fd28ba27f403b3adba | ||||||
| @@ -69,11 +69,11 @@ F src/test2.c 7f0ef466706ac01414e1136b96e5d8a65cb97545 | |||||||
| F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 | F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 | ||||||
| F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df | F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df | ||||||
| F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5 | F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5 | ||||||
| F src/tokenize.c 103cbaa932c790f540f8eceb63cd3010e117bdff | F src/tokenize.c fbe48ad208263b7c493fe16e29a293e6d47b451a | ||||||
| F src/trigger.c 1a6d0c7c51b70bdc58d5068be72034071eff23ad | F src/trigger.c 1a6d0c7c51b70bdc58d5068be72034071eff23ad | ||||||
| F src/update.c 04ea9dd784ccfeaf38a681b3edfe3b1c4edfdda7 | F src/update.c 04ea9dd784ccfeaf38a681b3edfe3b1c4edfdda7 | ||||||
| F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c | F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c | ||||||
| F src/util.c ac74ac096cbe61fe0139f041833a47c97a2dec07 | F src/util.c 1e1402e7115d0a81f92f43be50a2198c85fced5f | ||||||
| F src/vacuum.c bc1b36a56d0b4d86e1ed783cbdb24c5a54702e58 | F src/vacuum.c bc1b36a56d0b4d86e1ed783cbdb24c5a54702e58 | ||||||
| F src/vdbe.c d2574042c44baf6b1016c61e8072dec529ac748a | F src/vdbe.c d2574042c44baf6b1016c61e8072dec529ac748a | ||||||
| F src/vdbe.h 75e466d84d362b0c4498978a9d6b1e6bd32ecf3b | F src/vdbe.h 75e466d84d362b0c4498978a9d6b1e6bd32ecf3b | ||||||
| @@ -279,7 +279,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9 | |||||||
| F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 | F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 | ||||||
| F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b | F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b | ||||||
| F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b | F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b | ||||||
| P 20bd303e8c6f7e69ba82ce1dc3041ea4e02d55cf | P 254ac2213e695ead065ba3807d5d285046212fe1 | ||||||
| R 2b16f203bf20f4336c2f28ec0b8afc16 | R d1ea6d9ebc828607ed9bd32c6c8038d0 | ||||||
| U drh | U drh | ||||||
| Z 3a398f7449d7f6fee62866b5b69f1ae6 | Z 3ea66755830174fb2ac88e49c4d8b8fd | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 254ac2213e695ead065ba3807d5d285046212fe1 | a39c446726099e4915a1ad72c019d3c2cfe065bb | ||||||
| @@ -11,7 +11,7 @@ | |||||||
| ************************************************************************* | ************************************************************************* | ||||||
| ** Internal interface definitions for SQLite. | ** 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_ | #ifndef _SQLITEINT_H_ | ||||||
| #define _SQLITEINT_H_ | #define _SQLITEINT_H_ | ||||||
| @@ -1345,8 +1345,10 @@ void sqlite3RealToSortable(double r, char *); | |||||||
|   char *sqlite3StrDup(const char*); |   char *sqlite3StrDup(const char*); | ||||||
|   char *sqlite3StrNDup(const char*, int); |   char *sqlite3StrNDup(const char*, int); | ||||||
| # define sqlite3CheckMemory(a,b) | # define sqlite3CheckMemory(a,b) | ||||||
|  | # define sqlite3MallocX sqlite3Malloc | ||||||
| #endif | #endif | ||||||
| void sqlite3FreeX(void*); | void sqlite3FreeX(void*); | ||||||
|  | void *sqlite3MallocX(int); | ||||||
| char *sqlite3MPrintf(const char*, ...); | char *sqlite3MPrintf(const char*, ...); | ||||||
| char *sqlite3VMPrintf(const char*, va_list); | char *sqlite3VMPrintf(const char*, va_list); | ||||||
| void sqlite3DebugPrintf(const char*, ...); | void sqlite3DebugPrintf(const char*, ...); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
| ** individual tokens and sends those tokens one-by-one over to the | ** individual tokens and sends those tokens one-by-one over to the | ||||||
| ** parser for analysis. | ** 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 "sqliteInt.h" | ||||||
| #include "os.h" | #include "os.h" | ||||||
| @@ -341,7 +341,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ | |||||||
|   db->flags &= ~SQLITE_Interrupt; |   db->flags &= ~SQLITE_Interrupt; | ||||||
|   pParse->rc = SQLITE_OK; |   pParse->rc = SQLITE_OK; | ||||||
|   i = 0; |   i = 0; | ||||||
|   pEngine = sqlite3ParserAlloc((void*(*)(int))malloc); |   pEngine = sqlite3ParserAlloc((void*(*)(int))sqlite3MallocX); | ||||||
|   if( pEngine==0 ){ |   if( pEngine==0 ){ | ||||||
|     sqlite3SetString(pzErrMsg, "out of memory", (char*)0); |     sqlite3SetString(pzErrMsg, "out of memory", (char*)0); | ||||||
|     return 1; |     return 1; | ||||||
| @@ -401,7 +401,7 @@ abort_parse: | |||||||
|     } |     } | ||||||
|     sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse); |     sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse); | ||||||
|   } |   } | ||||||
|   sqlite3ParserFree(pEngine, free); |   sqlite3ParserFree(pEngine, sqlite3FreeX); | ||||||
|   if( sqlite3_malloc_failed ){ |   if( sqlite3_malloc_failed ){ | ||||||
|     pParse->rc = SQLITE_NOMEM; |     pParse->rc = SQLITE_NOMEM; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ | |||||||
| ** This file contains functions for allocating memory, comparing | ** This file contains functions for allocating memory, comparing | ||||||
| ** strings, and stuff like that. | ** 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 "sqliteInt.h" | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| @@ -112,6 +112,13 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){ | |||||||
|   return p; |   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() | ** 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 | ** and is able to hold at least N bytes.  Raise an exception if this | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user