The usecase of freeing result is to ensure that no data is left in result, to avoid unexpected behaviour elsewhere, so just move this outside of the closing bracket ;)