/ Check-in [8415d484]
Login

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

Overview
Comment:Instead of just commenting out the unneeded code in the previous check-in, remove it completely.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8415d4848ab36ca33b23d1fad6b063544de04a3b
User & Date: drh 2016-04-07 14:05:20
Context
2016-04-07
14:16
Avoid decrementing a pointer off the front end of the buffer in OP_MakeRecord. check-in: 153135bf user: drh tags: trunk
14:05
Instead of just commenting out the unneeded code in the previous check-in, remove it completely. check-in: 8415d484 user: drh tags: trunk
14:01
Remove an unnecessary test for a NULL pointer in freeP4(). check-in: e84e88e3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

   787    787   
   788    788   static void vdbeFreeOpArray(sqlite3 *, Op *, int);
   789    789   
   790    790   /*
   791    791   ** Delete a P4 value if necessary.
   792    792   */
   793    793   static void freeP4(sqlite3 *db, int p4type, void *p4){
   794         -  /*if( p4 )*/{
   795         -    assert( db );
   796         -    switch( p4type ){
   797         -      case P4_FUNCCTX: {
   798         -        freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc);
   799         -        /* Fall through into the next case */
   800         -      }
   801         -      case P4_REAL:
   802         -      case P4_INT64:
   803         -      case P4_DYNAMIC:
   804         -      case P4_INTARRAY: {
   805         -        sqlite3DbFree(db, p4);
   806         -        break;
   807         -      }
   808         -      case P4_KEYINFO: {
   809         -        if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
   810         -        break;
   811         -      }
          794  +  assert( db );
          795  +  switch( p4type ){
          796  +    case P4_FUNCCTX: {
          797  +      freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc);
          798  +      /* Fall through into the next case */
          799  +    }
          800  +    case P4_REAL:
          801  +    case P4_INT64:
          802  +    case P4_DYNAMIC:
          803  +    case P4_INTARRAY: {
          804  +      sqlite3DbFree(db, p4);
          805  +      break;
          806  +    }
          807  +    case P4_KEYINFO: {
          808  +      if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
          809  +      break;
          810  +    }
   812    811   #ifdef SQLITE_ENABLE_CURSOR_HINTS
   813         -      case P4_EXPR: {
   814         -        sqlite3ExprDelete(db, (Expr*)p4);
   815         -        break;
   816         -      }
   817         -#endif
   818         -      case P4_MPRINTF: {
   819         -        if( db->pnBytesFreed==0 ) sqlite3_free(p4);
   820         -        break;
   821         -      }
   822         -      case P4_FUNCDEF: {
   823         -        freeEphemeralFunction(db, (FuncDef*)p4);
   824         -        break;
   825         -      }
   826         -      case P4_MEM: {
   827         -        if( db->pnBytesFreed==0 ){
   828         -          sqlite3ValueFree((sqlite3_value*)p4);
   829         -        }else{
   830         -          Mem *p = (Mem*)p4;
   831         -          if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
   832         -          sqlite3DbFree(db, p);
   833         -        }
   834         -        break;
   835         -      }
   836         -      case P4_VTAB : {
   837         -        if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
   838         -        break;
   839         -      }
          812  +    case P4_EXPR: {
          813  +      sqlite3ExprDelete(db, (Expr*)p4);
          814  +      break;
          815  +    }
          816  +#endif
          817  +    case P4_MPRINTF: {
          818  +      if( db->pnBytesFreed==0 ) sqlite3_free(p4);
          819  +      break;
          820  +    }
          821  +    case P4_FUNCDEF: {
          822  +      freeEphemeralFunction(db, (FuncDef*)p4);
          823  +      break;
          824  +    }
          825  +    case P4_MEM: {
          826  +      if( db->pnBytesFreed==0 ){
          827  +        sqlite3ValueFree((sqlite3_value*)p4);
          828  +      }else{
          829  +        Mem *p = (Mem*)p4;
          830  +        if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
          831  +        sqlite3DbFree(db, p);
          832  +      }
          833  +      break;
          834  +    }
          835  +    case P4_VTAB : {
          836  +      if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
          837  +      break;
   840    838       }
   841    839     }
   842    840   }
   843    841   
   844    842   /*
   845    843   ** Free the space allocated for aOp and any p4 values allocated for the
   846    844   ** opcodes contained within. If aOp is not NULL it is assumed to contain