fixed memory leak in sample_from_gaussian