frees the memory associated with a result