Fix for bug #72: Make sure the file descriptors are properly closed if

sqliteInit() fails for any reason. (CVS 617)

FossilOrigin-Name: e67ac0fec51788aca0429d04310f86c9c1cf9d13
This commit is contained in:
drh 2002-06-14 20:54:14 +00:00
parent 6ca62f21e3
commit c67980bedc
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Fix\sfor\sbug\s#70:\sCorrect\sa\stypo\sin\sthe\sdocumentation.\s(CVS\s616)
D 2002-06-12T22:33:54
C Fix\sfor\sbug\s#72:\sMake\ssure\sthe\sfile\sdescriptors\sare\sproperly\sclosed\sif\nsqliteInit()\sfails\sfor\sany\sreason.\s(CVS\s617)
D 2002-06-14T20:54:15
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
@ -28,7 +28,7 @@ F src/func.c b8d0fd3011f53ea0e46b6bab857612eb36b5d1ea
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c 3a90bb98cd246f88cc26c44f24d5b47760bc5cba
F src/main.c 3a4e53122c0b0d0a5719b73fa9ec642761291ba1
F src/main.c c99dc0a52160a0935e7f663355100c0fcdfb35b3
F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b
F src/os.c 9cc40c5384baba4a85e160e67807645ca98ba3cc
F src/os.h 4a361fccfbc4e7609b3e1557f604f94c1e96ad10
@ -137,7 +137,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P 10da13612583caacc6fefe3a1f24187bfae2ebd7
R 7630ca2b47e9dd98945251969e3cced7
P 3387d5b6d62fbafea69fac7bb8256c37d5c6a4ba
R 55f4a18ed8c64842b0e836d93bcc263f
U drh
Z 5ea0c33800b40c2ccc0e239b3ee8e3e1
Z 3504b88b5175db600e1d0221cbd874dc

View File

@ -1 +1 @@
3387d5b6d62fbafea69fac7bb8256c37d5c6a4ba
e67ac0fec51788aca0429d04310f86c9c1cf9d13

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.78 2002/06/09 10:14:19 drh Exp $
** $Id: main.c,v 1.79 2002/06/14 20:54:15 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -352,6 +352,7 @@ sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){
/* Attempt to read the schema */
rc = sqliteInit(db, pzErrMsg);
db->magic = SQLITE_MAGIC_OPEN;
if( sqlite_malloc_failed ){
sqlite_close(db);
goto no_mem_on_open;
@ -363,7 +364,6 @@ sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){
sqliteFree(*pzErrMsg);
*pzErrMsg = 0;
}
db->magic = SQLITE_MAGIC_OPEN;
return db;
no_mem_on_open: