fix memory leaks for hash checks.