From 0f2af6c9c93f4e89ce7dac81ea0bc5f3309582ed Mon Sep 17 00:00:00 2001 From: Emilio Bellini Date: Wed, 17 Jan 2024 22:04:34 +0100 Subject: [PATCH] memory leaks --- source/fourier.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source/fourier.c b/source/fourier.c index 74780f68..c9b6d3bb 100644 --- a/source/fourier.c +++ b/source/fourier.c @@ -1517,7 +1517,7 @@ int fourier_init( pfo->error_message, pfo->error_message); } - class_call(fourier_hmcode(ppr, + class_call_except(fourier_hmcode(ppr, pba, ppt, ppm, @@ -1532,7 +1532,17 @@ int fourier_init( &nl_corr_not_computable_at_this_k, pnw), pfo->error_message, - pfo->error_message); + pfo->error_message, + fourier_hmcode_workspace_free(pfo,pnw); + for (index_pk=0; index_pkpk_size; index_pk++){ + free(pk_nl[index_pk]); + free(lnpk_l[index_pk]); + free(ddlnpk_l[index_pk]); + }; + free(pk_nl); + free(lnpk_l); + free(ddlnpk_l); + ); } /* infer and store R_NL=(P_NL/P_L)^1/2 */ @@ -3349,7 +3359,7 @@ int fourier_hmcode( } /* make a first guess for the nonlinear scale */ - class_call(array_interpolate_two_arrays_one_column( + class_call_except(array_interpolate_two_arrays_one_column( nu_arr, r_real, 1, @@ -3358,7 +3368,8 @@ int fourier_hmcode( nu_nl, &r_nl, pfo->error_message), - pfo->error_message, pfo->error_message); + pfo->error_message, pfo->error_message, + free(mass); free(r_real); free(r_virial); free(sigma_r); free(sigmaf_r); free(nu_arr);); class_call(array_search_bisect(ppr->nsteps_for_p1h_integral,nu_arr,nu_nl,&index_nl,pfo->error_message), pfo->error_message, pfo->error_message);