From: mistachkin Date: Fri, 16 Mar 2012 10:28:40 +0000 (+0000) Subject: Reset the sqlite3_data_directory and sqlite3_temp_directory variables when the sqlite... X-Git-Tag: version-3.7.13~11^2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4c46aaccda547a37032b58a30904fb8b0c37f97;p=thirdparty%2Fsqlite.git Reset the sqlite3_data_directory and sqlite3_temp_directory variables when the sqlite3_shutdown function is called since they may refer to memory allocated by the heap subsystem that was just shutdown. FossilOrigin-Name: cd70bc4b788b947d47a7a7158c27028160df06bd --- diff --git a/manifest b/manifest index ccb0bed86a..08d8b253c7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sSQLITE_WIN32_HEAP_CREATE\scompiler\sdefine\sto\scontrol\swhether\sor\snot\sthe\sWin32\snative\sallocator\swill\screate\san\sisolated\sheap\sfor\sall\sallocated\sdata. -D 2012-03-15T03:40:59.450 +C Reset\sthe\ssqlite3_data_directory\sand\ssqlite3_temp_directory\svariables\swhen\sthe\ssqlite3_shutdown\sfunction\sis\scalled\ssince\sthey\smay\srefer\sto\smemory\sallocated\sby\sthe\sheap\ssubsystem\sthat\swas\sjust\sshutdown. +D 2012-03-16T10:28:40.323 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -147,7 +147,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d -F src/main.c 5808bc6e2d2a80c3d73c42622fa162dc3cc24893 +F src/main.c d5ee3f6b60ed3692ffaa2ecfd1f9ea75439320f9 F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P d3d071598aba367e3d73001ab38d7a78306875ea -R 0bb904de4ab0ea378e0e14a8a8dc9e9c +P 8693fb652ecd1ad0b03e9067839970b321c3f904 +R 82dc6fe8495302f5fea0d7d19dfd1f47 U mistachkin -Z a4be176b4e96926a736affae28592011 +Z d2503b8281f3d675b1a2c9e9f5230508 diff --git a/manifest.uuid b/manifest.uuid index f8b2016426..06f5280483 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8693fb652ecd1ad0b03e9067839970b321c3f904 \ No newline at end of file +cd70bc4b788b947d47a7a7158c27028160df06bd \ No newline at end of file diff --git a/src/main.c b/src/main.c index 601138b8df..31e5fb870d 100644 --- a/src/main.c +++ b/src/main.c @@ -287,6 +287,15 @@ int sqlite3_shutdown(void){ sqlite3GlobalConfig.isMutexInit = 0; } + /* The heap subsystem has now been shutdown and these values are supposed + ** to be NULL or point to memory that was obtained from sqlite3_malloc(), + ** which would rely on that heap subsystem; therefore, make sure these + ** values cannot refer to heap memory that was just invalidated when the + ** heap subsystem was shutdown. + */ + sqlite3_data_directory = 0; + sqlite3_temp_directory = 0; + return SQLITE_OK; }