/ Check-in [ed511c2e]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a memory allocation problem in os_test.c (CVS 1782)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ed511c2ea9581933ca504ce4b43d863503c6cc22
User & Date: danielk1977 2004-06-30 12:42:59
Context
2004-06-30
12:49
Have the debug version of sqliteRealloc() return partially uninitialised memory in the same way as the non-debug version can. (CVS 1783) check-in: e78b0ff3 user: danielk1977 tags: trunk
12:42
Fix a memory allocation problem in os_test.c (CVS 1782) check-in: ed511c2e user: danielk1977 tags: trunk
11:54
Coverage improvements for malloc and vdbemem.c (CVS 1781) check-in: a98dd004 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_test.c.

   155    155   ** Load block 'blk' into the cache of pFile.
   156    156   */
   157    157   static int cacheBlock(OsTestFile *pFile, int blk){
   158    158     if( blk>=pFile->nBlk ){
   159    159       int n = ((pFile->nBlk * 2) + 100 + blk);
   160    160       pFile->apBlk = (u8 **)sqliteRealloc(pFile->apBlk, n * sizeof(u8*));
   161    161       if( !pFile->apBlk ) return SQLITE_NOMEM;
          162  +    memset(&pFile->apBlk[pFile->nBlk], 0, (n - pFile->nBlk)*sizeof(u8*));
   162    163       pFile->nBlk = n;
   163    164     }
   164    165   
   165    166     if( !pFile->apBlk[blk] ){
   166    167       off_t filesize;
   167    168       int rc;
   168    169   

Changes to src/tclsqlite.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** A TCL Interface to SQLite
    13     13   **
    14         -** $Id: tclsqlite.c,v 1.94 2004/06/30 11:54:07 danielk1977 Exp $
           14  +** $Id: tclsqlite.c,v 1.95 2004/06/30 12:42:59 danielk1977 Exp $
    15     15   */
    16     16   #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
    17     17   
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include <stdlib.h>
    21     21   #include <string.h>
................................................................................
  1077   1077   
  1078   1078     /* If compiled with SQLITE_TEST turned on, then register the "md5sum"
  1079   1079     ** SQL function.
  1080   1080     */
  1081   1081   #ifdef SQLITE_TEST
  1082   1082     {
  1083   1083       extern void Md5_Register(sqlite*);
         1084  +#ifdef SQLITE_DEBUG
  1084   1085       int mallocfail = sqlite3_iMallocFail;
  1085   1086       sqlite3_iMallocFail = 0;
         1087  +#endif
  1086   1088       Md5_Register(p->db);
         1089  +#ifdef SQLITE_DEBUG
  1087   1090       sqlite3_iMallocFail = mallocfail;
         1091  +#endif
  1088   1092      }
  1089   1093   #endif  
  1090   1094     p->interp = interp;
  1091   1095     return TCL_OK;
  1092   1096   }
  1093   1097   
  1094   1098   /*