fixed memory leaks from unit-test LogDetEstimator.Sparse_sample #1989