[hist] fix potential memory leak