Index: src/util.c ================================================================== --- src/util.c +++ src/util.c @@ -12,11 +12,11 @@ ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.138 2005/06/25 18:42:15 drh Exp $ +** $Id: util.c,v 1.139 2005/06/29 15:33:00 drh Exp $ */ #include "sqliteInt.h" #include #include @@ -266,10 +266,11 @@ ** Allocate new memory and set it to zero. Return NULL if ** no memory is available. See also sqliteMallocRaw(). */ void *sqlite3Malloc(int n){ void *p; + if( n==0 ) return 0; if( (p = malloc(n))==0 ){ if( n>0 ) sqlite3_malloc_failed++; }else{ memset(p, 0, n); }