add the memory allocate and free.

N/A

Signed-off-by: liminghao <liminghao@xiaomi.com>