The result should also be freed when there was an error?