pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:231:    if (!a->num_pages) return;   #else    if (!a->allocated) return;   #endif       PAGE_LOOP(a, {    PIKE_MEM_RW_RANGE(p, BA_PAGESIZE(a));    free(p);    });    +  a->free_blk = NULL; +  a->alloc = NULL;    a->num_pages = 0;    a->empty_pages = 0;    a->empty = a->first = NULL;   #ifdef BA_USE_MEMALIGN    a->full = NULL;   #else    a->last_free = NULL;    a->allocated = BA_ALLOC_INITIAL;    memset(a->pages, 0, a->allocated * sizeof(ba_page));   #endif
pike.git/src/block_allocator.c:268:   }      PMOD_EXPORT INLINE void ba_destroy(struct block_allocator * a) {    unsigned int i;       PAGE_LOOP(a, {    PIKE_MEM_RW_RANGE(p, BA_PAGESIZE(a));    free(p);    });    +  a->free_blk = NULL; +  a->alloc = NULL;   #ifdef BA_USE_MEMALIGN    a->full = NULL;   #else    PIKE_MEM_RW_RANGE(a->pages, BA_BYTES(a));    free(a->pages);    a->last_free = NULL;    a->allocated = 0;    a->pages = NULL;   #endif    a->empty = a->first = NULL;
pike.git/src/block_allocator.c:660:    a->alloc = a->first;    DOUBLE_SHIFT(a->first);    } else if (a->empty) {    a->alloc = a->empty;    SINGLE_SHIFT(a->empty);    a->empty_pages--;    } else {    a->alloc = NULL;    ba_alloc_page(a);    } +  a->alloc->next = NULL;       a->free_blk = a->alloc->first;      #ifdef BA_DEBUG    if (!a->free_blk) {    ba_show_pages(a);    BA_ERROR("a->first has no first block!\n");    }   #endif