freeing segment memory in unmap