1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Allow sqlite3_shutdown() to be called by a process before sqlite3_initialize() is. Prior to this commit such a call could segfault. (CVS 6296)

FossilOrigin-Name: 79431c58d964d6057c7f42f7c1df74f3df4493eb
This commit is contained in:
danielk1977
2009-02-17 16:29:10 +00:00
parent e8df800d4c
commit 0a54907159
5 changed files with 25 additions and 15 deletions

View File

@@ -12,7 +12,7 @@
**
** Memory allocation functions used throughout sqlite.
**
** $Id: malloc.c,v 1.54 2009/01/20 16:53:41 danielk1977 Exp $
** $Id: malloc.c,v 1.55 2009/02/17 16:29:11 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -153,7 +153,9 @@ int sqlite3MallocInit(void){
** Deinitialize the memory allocation subsystem.
*/
void sqlite3MallocEnd(void){
sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData);
if( sqlite3GlobalConfig.m.xShutdown ){
sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData);
}
memset(&mem0, 0, sizeof(mem0));
}