/ Check-in [71808745]
Login

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

Overview
Comment:Check for multiple calls to sqlite3FailedMalloc(). Ignore the second and subsequent calls. (CVS 3691)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7180874592ffcaf8e2fe3c3b6b37449654da709b
User & Date: danielk1977 2007-03-15 15:33:32
Context
2007-03-15
15:35
Save an if(...) clause made redundant by (3691). (CVS 3692) check-in: 8153edf8 user: danielk1977 tags: trunk
15:33
Check for multiple calls to sqlite3FailedMalloc(). Ignore the second and subsequent calls. (CVS 3691) check-in: 71808745 user: danielk1977 tags: trunk
12:51
Fix the pager so that it handles persistent I/O errors correctly. Update the testing infrastructure so that it tests for persistent I/O errors instead of just transient errors. (CVS 3690) check-in: ea8507a7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.193 2006/09/15 07:28:51 drh Exp $
           17  +** $Id: util.c,v 1.194 2007/03/15 15:33:32 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <stdarg.h>
    22     22   #include <ctype.h>
    23     23   
    24     24   /*
................................................................................
  1457   1457     return (mallocHasFailed && sqlite3OsInMutex(1));
  1458   1458   }
  1459   1459   
  1460   1460   /* 
  1461   1461   ** Set the "malloc has failed" condition to true for this thread.
  1462   1462   */
  1463   1463   void sqlite3FailedMalloc(){
  1464         -  sqlite3OsEnterMutex();
  1465         -  assert( mallocHasFailed==0 );
  1466         -  mallocHasFailed = 1;
         1464  +  if( !sqlite3MallocFailed() ){
         1465  +    sqlite3OsEnterMutex();
         1466  +    assert( mallocHasFailed==0 );
         1467  +    mallocHasFailed = 1;
         1468  +  }
  1467   1469   }
  1468   1470   
  1469   1471   #ifdef SQLITE_MEMDEBUG
  1470   1472   /*
  1471   1473   ** This function sets a flag in the thread-specific-data structure that will
  1472   1474   ** cause an assert to fail if sqliteMalloc() or sqliteRealloc() is called.
  1473   1475   */