aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2020-02-10 09:35:22 -0600
committertlatorre <tlatorre@uchicago.edu>2020-02-10 09:35:22 -0600
commita2b3a8097c5ac3e2e74af2e10e75f6aa571990a8 (patch)
tree4d2b286e4fd574b073901cf5ed3fe9e2b9b68121 /src
parentbccf9e927ab13ffaae639e6d93a56c0e7f3cacd3 (diff)
downloadsddm-a2b3a8097c5ac3e2e74af2e10e75f6aa571990a8.tar.gz
sddm-a2b3a8097c5ac3e2e74af2e10e75f6aa571990a8.tar.bz2
sddm-a2b3a8097c5ac3e2e74af2e10e75f6aa571990a8.zip
fix small memory leak in get_expected_photons()
Diffstat (limited to 'src')
-rw-r--r--src/fit.c3
1 files changed, 3 insertions, 0 deletions
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;