From a2b3a8097c5ac3e2e74af2e10e75f6aa571990a8 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Mon, 10 Feb 2020 09:35:22 -0600 Subject: fix small memory leak in get_expected_photons() --- src/fit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/fit.c b/src/fit.c index a5d531a..0fa8766 100644 --- a/src/fit.c +++ b/src/fit.c @@ -5240,6 +5240,7 @@ double get_expected_photons(int id, double T0, double distance, double cos_theta break; default: fprintf(stderr, "unknown particle id %i\n", id); + particle_free(p); exit(1); } @@ -5255,6 +5256,8 @@ double get_expected_photons(int id, double T0, double distance, double cos_theta nphotons += p->delta_ray_photons*distance/p->range*(1-interp1d(cos_theta,p->cos_theta,p->cdf_delta,p->n)); } + particle_free(p); + /* Finally we multiply by the average quantum efficiency and divide by 2 to * account for the PMT coverage. */ return nphotons*get_weighted_quantum_efficiency()/2.0; -- cgit