free alloc memory after use

I think we should free the memory here.