How to have allocated pointer and size information along with memory allocation?

when I use heap space, along with the allocation I need the information of 1) allocated pointer, 2) size, 3) line number, 4) file name.

extendMalloc +—+—+—+—+———–+ | 1 | 2 | 3 | 4 | malloc | +—+—+—+—+———–+

When memory is freed, it has to be freed with extendMalloc information.