/ Check-in [a8760213]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a memory leak that occurred when sqlite_open() failed. (CVS 745)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a876021304a5de7ede1bf835971da7e328d1af07
User & Date: drh 2002-09-05 23:21:37
Context
2002-09-08
00:04
Modify the build process so that the VDBE opcode numbers and the table that contains the opcode names are both automatically generated. This makes it much easier to create new VDBE opcodes. (CVS 746) check-in: eb54d455 user: drh tags: trunk
2002-09-05
23:21
Fix a memory leak that occurred when sqlite_open() failed. (CVS 745) check-in: a8760213 user: drh tags: trunk
19:10
Rewind the checkpoint journal after each statement to avoid allowing the file to become too large. (CVS 744) check-in: f4288520 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.101 2002/09/03 19:43:24 drh Exp $
           17  +** $Id: main.c,v 1.102 2002/09/05 23:21:37 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** A pointer to this structure is used to communicate information
................................................................................
   351    351     if( pzErrMsg ) *pzErrMsg = 0;
   352    352     if( db==0 ) goto no_mem_on_open;
   353    353     sqliteHashInit(&db->tblHash, SQLITE_HASH_STRING, 0);
   354    354     sqliteHashInit(&db->idxHash, SQLITE_HASH_STRING, 0);
   355    355     sqliteHashInit(&db->trigHash, SQLITE_HASH_STRING, 0);
   356    356     sqliteHashInit(&db->aFunc, SQLITE_HASH_STRING, 1);
   357    357     sqliteHashInit(&db->aFKey, SQLITE_HASH_STRING, 1);
   358         -  sqliteRegisterBuiltinFunctions(db);
   359    358     db->onError = OE_Default;
   360    359     db->priorNewRowid = 0;
   361    360     db->magic = SQLITE_MAGIC_BUSY;
   362    361     
   363    362     /* Open the backend database driver */
   364    363     rc = sqliteBtreeOpen(zFilename, mode, MAX_PAGES, &db->pBe);
   365    364     if( rc!=SQLITE_OK ){
................................................................................
   370    369       }
   371    370       sqliteFree(db);
   372    371       sqliteStrRealloc(pzErrMsg);
   373    372       return 0;
   374    373     }
   375    374   
   376    375     /* Attempt to read the schema */
          376  +  sqliteRegisterBuiltinFunctions(db);
   377    377     rc = sqliteInit(db, pzErrMsg);
   378    378     db->magic = SQLITE_MAGIC_OPEN;
   379    379     if( sqlite_malloc_failed ){
   380    380       sqlite_close(db);
   381    381       goto no_mem_on_open;
   382    382     }else if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
   383    383       sqlite_close(db);