/ Check-in [78cb8a9a]
Login

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

Overview
Comment:Check for zero-byte allocations in sqlite3MallocRaw. (CVS 2533)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:78cb8a9a17a29bb8d9ffb6298b25cc43f9cbfed9
User & Date: drh 2005-06-29 17:24:24
Context
2005-06-30
17:04
Allow the DEFAULT value of a column to be obtained by calling a function that has constant arguments, such as julianday('now'). (CVS 2534) check-in: d273766e user: drh tags: trunk
2005-06-29
17:24
Check for zero-byte allocations in sqlite3MallocRaw. (CVS 2533) check-in: 78cb8a9a user: drh tags: trunk
15:33
Make sqlite3Malloc always return NULL when the number of bytes to allocate is 0. (CVS 2532) check-in: 657d74eb 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.139 2005/06/29 15:33:00 drh Exp $
           17  +** $Id: util.c,v 1.140 2005/06/29 17:24:24 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   #if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
    24     24   #include <execinfo.h>
................................................................................
   279    279   
   280    280   /*
   281    281   ** Allocate new memory but do not set it to zero.  Return NULL if
   282    282   ** no memory is available.  See also sqliteMalloc().
   283    283   */
   284    284   void *sqlite3MallocRaw(int n){
   285    285     void *p;
          286  +  if( n==0 ) return 0;
   286    287     if( (p = malloc(n))==0 ){
   287    288       if( n>0 ) sqlite3_malloc_failed++;
   288    289     }
   289    290     return p;
   290    291   }
   291    292   
   292    293   /*