phash: plug memory leak