/ Check-in [4a7b3fa0]
Login

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

Overview
Comment:Rearrange an expression in vdbemem.c to avoid a (harmless) reference to a possibly unitialized variable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4a7b3fa049a9aa0668e318287edd4a78c0588bf8
User & Date: dan 2014-10-15 11:31:35
Context
2014-10-15
11:55
Add a four-byte prefix to the BtShared.pTmpSpace buffer to avoid reading before the beginning of an allocation. check-in: 9386bfca user: drh tags: trunk
11:31
Rearrange an expression in vdbemem.c to avoid a (harmless) reference to a possibly unitialized variable. check-in: 4a7b3fa0 user: dan tags: trunk
2014-10-14
20:25
Make sure new sqlite3_vtab objects created by the xCreate() virtual table method are initialized by the system, in accordance with the documentation. check-in: eab82330 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

   139    139         pMem->szMalloc = 0;
   140    140         return SQLITE_NOMEM;
   141    141       }else{
   142    142         pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
   143    143       }
   144    144     }
   145    145   
   146         -  if( pMem->z && bPreserve && pMem->z!=pMem->zMalloc ){
          146  +  if( bPreserve && pMem->z && pMem->z!=pMem->zMalloc ){
   147    147       memcpy(pMem->zMalloc, pMem->z, pMem->n);
   148    148     }
   149    149     if( (pMem->flags&MEM_Dyn)!=0 ){
   150    150       assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC );
   151    151       pMem->xDel((void *)(pMem->z));
   152    152     }
   153    153