/ Check-in [cb4e242e]
Login

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

Overview
Comment:Fix another uninitialized Mem.xDel problem. (CVS 1672)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cb4e242e83ba111c5da1f9662fda5a890051e7b0
User & Date: drh 2004-06-22 22:54:23
Context
2004-06-23
00:23
Add a comment to the output buffer allocation in sqlite3VdbeMemTranslate() (CVS 1673) check-in: e2f7f182 user: danielk1977 tags: trunk
2004-06-22
22:54
Fix another uninitialized Mem.xDel problem. (CVS 1672) check-in: cb4e242e user: drh tags: trunk
22:04
Be careful to initialize the Mem.xDel field to zero for static Mems. (CVS 1671) check-in: e17ea666 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.387 2004/06/22 17:59:56 drh Exp $
           46  +** $Id: vdbe.c,v 1.388 2004/06/22 22:54:23 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  1254   1254     }else{
  1255   1255       ctx.pVdbeFunc = (VdbeFunc*)pOp->p3;
  1256   1256       ctx.pFunc = ctx.pVdbeFunc->pFunc;
  1257   1257     }
  1258   1258   
  1259   1259     ctx.s.flags = MEM_Null;
  1260   1260     ctx.s.z = 0;
         1261  +  ctx.s.xDel = 0;
  1261   1262     ctx.isError = 0;
  1262   1263     ctx.isStep = 0;
  1263   1264     if( ctx.pFunc->needCollSeq ){
  1264   1265       assert( pOp>p->aOp );
  1265   1266       assert( pOp[-1].p3type==P3_COLLSEQ );
  1266   1267       assert( pOp[-1].opcode==OP_CollSeq );
  1267   1268       ctx.pColl = (CollSeq *)pOp[-1].p3;

Changes to src/vdbemem.c.

   572    572       int x = pMem->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short);
   573    573       assert( x!=0 );            /* Strings must define a string subtype */
   574    574       assert( (x & (x-1))==0 );  /* Only one string subtype can be defined */
   575    575       assert( pMem->z!=0 );      /* Strings must have a value */
   576    576       /* Mem.z points to Mem.zShort iff the subtype is MEM_Short */
   577    577       assert( (pMem->flags & MEM_Short)==0 || pMem->z==pMem->zShort );
   578    578       assert( (pMem->flags & MEM_Short)!=0 || pMem->z!=pMem->zShort );
          579  +    /* No destructor unless there is MEM_Dyn */
          580  +    assert( pMem->xDel==0 || (pMem->flags & MEM_Dyn)!=0 );
   579    581   
   580    582       if( (flags & MEM_Str) ){
   581    583         assert( pMem->enc==SQLITE_UTF8 || 
   582    584                 pMem->enc==SQLITE_UTF16BE ||
   583    585                 pMem->enc==SQLITE_UTF16LE 
   584    586         );
   585    587         /* If the string is UTF-8 encoded and nul terminated, then pMem->n
................................................................................
   588    590         if( pMem->enc==SQLITE_UTF8 && (flags & MEM_Term) ){ 
   589    591           assert( strlen(pMem->z)==pMem->n );
   590    592         }
   591    593       }
   592    594     }else{
   593    595       /* Cannot define a string subtype for non-string objects */
   594    596       assert( (pMem->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short))==0 );
          597  +    assert( pMem->xDel==0 );
   595    598     }
   596    599     /* MEM_Null excludes all other types */
   597    600     assert( (pMem->flags&(MEM_Str|MEM_Int|MEM_Real|MEM_Blob))==0
   598    601             || (pMem->flags&MEM_Null)==0 );
   599    602   }
   600    603   #endif
   601    604