/ Check-in [ef0e40e8]
Login

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

Overview
Comment:Fix for memory leak in malloc3.test. (CVS 4913)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ef0e40e814b3d3a00721f8ca39bac0db1be24347
User & Date: danielk1977 2008-03-25 09:56:45
Context
2008-03-25
14:24
Have each {quote: BtShared} structure hang on to a buffer of just under page-size bytes for temporary use. This reduces the number of calls to malloc(). (CVS 4914) check-in: fe1bc0f3 user: danielk1977 tags: trunk
09:56
Fix for memory leak in malloc3.test. (CVS 4913) check-in: ef0e40e8 user: danielk1977 tags: trunk
09:47
Use a vdbe memory cell to allocate the space required for vdbe cursors. (CVS 4912) check-in: 04715364 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     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         -** $Id: btree.c,v 1.444 2008/03/25 09:47:35 danielk1977 Exp $
           12  +** $Id: btree.c,v 1.445 2008/03/25 09:56:45 danielk1977 Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
  3640   3640           int available;
  3641   3641           pCellKey = (void *)fetchPayload(pCur, &available, 0);
  3642   3642           nCellKey = pCur->info.nKey;
  3643   3643           if( available>=nCellKey ){
  3644   3644             c = sqlite3VdbeRecordCompareParsed(nCellKey, pCellKey, pPKey);
  3645   3645           }else{
  3646   3646             pCellKey = sqlite3_malloc( nCellKey );
  3647         -          if( pCellKey==0 ) return SQLITE_NOMEM;
         3647  +          if( pCellKey==0 ){
         3648  +            rc = SQLITE_NOMEM;
         3649  +            goto moveto_finish;
         3650  +          }
  3648   3651             rc = sqlite3BtreeKey(pCur, 0, nCellKey, (void *)pCellKey);
  3649   3652             c = sqlite3VdbeRecordCompareParsed(nCellKey, pCellKey, pPKey);
  3650   3653             sqlite3_free(pCellKey);
  3651   3654             if( rc ) goto moveto_finish;
  3652   3655           }
  3653   3656         }
  3654   3657         if( c==0 ){