mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Add SQLITE_OMIT_SHUTDOWN_DIRECTORIES compile-time option to disable clearing the sqlite3_data_directory and sqlite3_temp_directory variables during sqlite3_shutdown. Also, only clear the variables if the heap was actually shutdown.
FossilOrigin-Name: 1ae9f9e4f730eccbc0fc3408de1ac3c4be931e01
This commit is contained in:
21
src/main.c
21
src/main.c
@@ -281,21 +281,24 @@ int sqlite3_shutdown(void){
|
||||
if( sqlite3GlobalConfig.isMallocInit ){
|
||||
sqlite3MallocEnd();
|
||||
sqlite3GlobalConfig.isMallocInit = 0;
|
||||
|
||||
#ifndef SQLITE_OMIT_SHUTDOWN_DIRECTORIES
|
||||
/* 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. This is only done if the current call to
|
||||
** this function resulted in the heap subsystem actually being shutdown.
|
||||
*/
|
||||
sqlite3_data_directory = 0;
|
||||
sqlite3_temp_directory = 0;
|
||||
#endif
|
||||
}
|
||||
if( sqlite3GlobalConfig.isMutexInit ){
|
||||
sqlite3MutexEnd();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user