MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / do_check_free_chunk

Function do_check_free_chunk

dlmalloc/dlmalloc.c:2647–2667  ·  view source on GitHub ↗

Check properties of free chunks */

Source from the content-addressed store, hash-verified

2645
2646/* Check properties of free chunks */
2647static void do_check_free_chunk(mstate m, mchunkptr p) {
2648 size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT);
2649 mchunkptr next = chunk_plus_offset(p, sz);
2650 do_check_any_chunk(m, p);
2651 assert(!cinuse(p));
2652 assert(!next_pinuse(p));
2653 assert (!is_mmapped(p));
2654 if (p != m->dv && p != m->top) {
2655 if (sz >= MIN_CHUNK_SIZE) {
2656 assert((sz & CHUNK_ALIGN_MASK) == 0);
2657 assert(is_aligned(chunk2mem(p)));
2658 assert(next->prev_foot == sz);
2659 assert(pinuse(p));
2660 assert (next == m->top || cinuse(next));
2661 assert(p->fd->bk == p);
2662 assert(p->bk->fd == p);
2663 }
2664 else /* markers are always of size SIZE_T_SIZE */
2665 assert(sz == SIZE_T_SIZE);
2666 }
2667}
2668
2669/* Check properties of malloced chunks at the point they are malloced */
2670static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {

Callers 2

do_check_smallbinFunction · 0.85
traverse_and_checkFunction · 0.85

Calls 1

do_check_any_chunkFunction · 0.85

Tested by

no test coverage detected