if( (((unsigned long)it->base) & MBLOCK_MASK) == 0) { /* MBlock aligned */
ret = (void*)it->base;
if(it->size==required_size) {
- prev->next=0;
+ prev->next=it->next;
stgFree(it);
} else {
it->base += required_size;
commitBlocks(char* base, int size) {
alloc_rec* it;
it=allocs;
- for( ; it!=0 && (it->base+it->size)<base; it=it->next ) {}
+ for( ; it!=0 && (it->base+it->size)<=base; it=it->next ) {}
for( ; it!=0 && size>0; it=it->next ) {
int size_delta;
void* temp;