core: use structure itself for sizeof in two malloc