fix memory leak in HistFactory::Sample