/ Check-in [767ccb1f]
Login

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

Overview
Comment:Fix a potential memory use-after-free problem following an OOM error.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 767ccb1fa11b3e7b895fb8c2e91f79e3b4202907
User & Date: drh 2014-03-04 18:06:04
Context
2014-03-04
21:00
Fix a problem with "DEFAULT (-(-9223372036854775808))" clauses in ALTER TABLE ... ADD COLUMN commands. check-in: e072cb3e user: dan tags: trunk
18:06
Fix a potential memory use-after-free problem following an OOM error. check-in: 767ccb1f user: drh tags: trunk
16:21
Fix an assert() so that it takes OOM errors into account. check-in: 53f6ec79 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

   118    118         bPreserve = 0;
   119    119       }else{
   120    120         sqlite3DbFree(pMem->db, pMem->zMalloc);
   121    121         pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
   122    122       }
   123    123       if( pMem->zMalloc==0 ){
   124    124         VdbeMemRelease(pMem);
          125  +      pMem->z = 0;
   125    126         pMem->flags = MEM_Null;  
   126    127         return SQLITE_NOMEM;
   127    128       }
   128    129     }
   129    130   
   130    131     if( pMem->z && bPreserve && pMem->z!=pMem->zMalloc ){
   131    132       memcpy(pMem->zMalloc, pMem->z, pMem->n);