# define _MALLOC_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock);
#endif /* __FreeBSD__ */
+#include <assert.h>
+
#include <sys/types.h>
#if defined(__NetBSD__)
# define malloc_minsize 16U
pf->size > malloc_cache && /* ..and the cache is full, */
pf->end == malloc_brk && /* ..and none behind us, */
malloc_brk == sbrk((intptr_t)0)) { /* ..and it's OK to do... */
-
+ int r;
/*
* Keep the cache intact. Notice that the '>' above guarantees that
* the pf will always have at least one page afterwards.
pf->end = (char *)pf->page + malloc_cache;
pf->size = malloc_cache;
- brk(pf->end);
+ r = brk(pf->end);
+ assert(r >= 0);
malloc_brk = pf->end;
idx = ptr2idx(pf->end);
if(start == 0 && len == region->length)
full = 1;
+ physr_init_iter(&iter);
physr_start_iter(region->phys, &iter, start, AVL_GREATER_EQUAL);
while((pr = physr_get_iter(&iter))) {
physr_incr_iter(&iter);
if(!(newpb = pb_new(ml->phys)) ||
!(newphysr = pb_reference(newpb, offset, region))) {
printf("map_new_physblock: no memory for the ph slabs\n");
- if(newphysr) SLABFREE(newphysr);
+ assert(!newphysr);
if(newpb) SLABFREE(newpb);
r = ENOMEM;
break;
* point to the same addresses, make them shrink by the
* same amount.
*/
+ physr_init_iter(&iter);
physr_start_iter(r->phys, &iter, offset, AVL_GREATER_EQUAL);
while((pr = physr_get_iter(&iter))) {