/ Check-in [b98a8706]
Login

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

Overview
Comment:Always call sqlite3_malloc() in sqlite3OsInit(), even when not compiled with SQLITE_TEST.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b98a8706a61ad27c881b6820eee10d06bfb27417
User & Date: drh 2009-08-17 16:01:11
Context
2009-08-18
01:54
Fix a bug in mem5.c which would cause an infinite loop on an attempt to allocate more than 1073741824 bytes of contiguous memory. Also, some cleanup of mem5.c. More work to do on this. check-in: 783b751a user: drh tags: trunk
2009-08-17
16:01
Always call sqlite3_malloc() in sqlite3OsInit(), even when not compiled with SQLITE_TEST. check-in: b98a8706 user: drh tags: trunk
15:52
Move error simulation code from the sqlite3_os_init() functions into a wrapper. check-in: 67ad21ab user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os.c.

   193    193   /*
   194    194   ** This function is a wrapper around the OS specific implementation of
   195    195   ** sqlite3_os_init(). The purpose of the wrapper is to provide the
   196    196   ** ability to simulate a malloc failure, so that the handling of an
   197    197   ** error in sqlite3_os_init() by the upper layers can be tested.
   198    198   */
   199    199   int sqlite3OsInit(void){
   200         -  DO_OS_MALLOC_TEST(0);
          200  +  void *p = sqlite3_malloc(10);
          201  +  if( p==0 ) return SQLITE_NOMEM;
          202  +  sqlite3_free(p);
   201    203     return sqlite3_os_init();
   202    204   }
   203    205   
   204    206   /*
   205    207   ** The list of all registered VFS implementations.
   206    208   */
   207    209   static sqlite3_vfs * SQLITE_WSD vfsList = 0;