common: refine heap.c

Signed-off-by: Yibo Cai <cyb70289@gmail.com>