free malloc buffers