/ Check-in [c573b0a1]
Login

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

Overview
Comment:Simplification to error handling in addModuleArgument() in the virtual table processing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c573b0a1aa3ba509234f07520fa94d008bcbb330
User & Date: drh 2015-08-19 12:45:57
Context
2015-08-20
17:18
Make SQLITE_BUSY_SNAPSHOT and SQLITE_BUSY_RECOVERY retryable, just as a plain SQLITE_BUSY is. check-in: fd13dd95 user: drh tags: trunk
2015-08-19
12:52
Merge changes from trunk. check-in: dddd792d user: drh tags: table-valued-functions
12:45
Simplification to error handling in addModuleArgument() in the virtual table processing. check-in: c573b0a1 user: drh tags: trunk
08:34
When updating a zipvfs database with RBU, set journal_mode=off to prevent the upper-level pager from creating a large temporary file. check-in: dec14a39 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vtab.c.

   281    281   /*
   282    282   ** Add a new module argument to pTable->azModuleArg[].
   283    283   ** The string is not copied - the pointer is stored.  The
   284    284   ** string will be freed automatically when the table is
   285    285   ** deleted.
   286    286   */
   287    287   static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){
   288         -  int i = pTable->nModuleArg++;
   289         -  int nBytes = sizeof(char *)*(1+pTable->nModuleArg);
          288  +  int nBytes = sizeof(char *)*(2+pTable->nModuleArg);
   290    289     char **azModuleArg;
   291    290     azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);
   292    291     if( azModuleArg==0 ){
   293         -    int j;
   294         -    for(j=0; j<i; j++){
   295         -      sqlite3DbFree(db, pTable->azModuleArg[j]);
   296         -    }
   297    292       sqlite3DbFree(db, zArg);
   298         -    sqlite3DbFree(db, pTable->azModuleArg);
   299         -    pTable->nModuleArg = 0;
   300    293     }else{
          294  +    int i = pTable->nModuleArg++;
   301    295       azModuleArg[i] = zArg;
   302    296       azModuleArg[i+1] = 0;
          297  +    pTable->azModuleArg = azModuleArg;
   303    298     }
   304         -  pTable->azModuleArg = azModuleArg;
   305    299   }
   306    300   
   307    301   /*
   308    302   ** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE
   309    303   ** statement.  The module name has been parsed, but the optional list
   310    304   ** of parameters that follow the module name are still pending.
   311    305   */