On Feb 12, 2004, at 4:53 PM, James W. Walker wrote:
I'm using in-memory temporary tables for the first time, and running into a problem. memRbtreeInsert asks sqliteMallocRaw to allocate zero bytes, malloc returns NULL, and as a result, sqliteMallocRaw sets the sqlite_malloc_failed flag. According to the C99 standard, it is legal for malloc(0) to be NULL. Should I patch sqliteMallocRaw, or does this indicate a problem higher up the call chain?
Which version of SQLite are you using? I think this has been fixed in the latest release. This is what I have for sqliteMallocRaw():
void *sqliteMallocRaw(int n){
void *p;
if( (p = malloc(n))==0 ){
if( n>0 ) sqlite_malloc_failed++;
}
return p;
}That looks like it will only increment sqlite_malloc_failed if the malloc returns 0 and the amount asked for is greater than 0.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

