I think there is a logic error in check in 3056:
void *sqlite3Realloc(void *p, int n){
void *np = 0;
if( !sqlite3MallocFailed() ){
#ifndef SQLITE_ENABLE_MEMORY_MANAGEMENT
int oldsize = OSSIZEOF(p);
#endif
while( (np = OSREALLOC(p, n))==0 && sqlite3_release_memory(n) );
if( !np || handleSoftLimit(OSSIZEOF(np) - oldsize) ){
OSFREE(np);
sqlite3FailedMalloc();
OSMALLOC_FAILED();
}
}
return np;
}Variable oldsize in line 595 is not initialized if macro SQLITE_ENABLE_MEMORY_MANAGEMENT is set.

