hash: fix memory leak in last patch