From ff567572586387fb3068f9e59765d05fb3bbc389 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Mon, 6 Apr 2020 08:54:10 +0000 Subject: [PATCH] ex-1: fix leak in landau_qdf --- ex-1/landau.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ex-1/landau.c b/ex-1/landau.c index 5728721..6a4a982 100644 --- a/ex-1/landau.c +++ b/ex-1/landau.c @@ -92,6 +92,10 @@ double landau_qdf(double p0) { } fprintf(stderr, "QDF error: %.3g\n", upp - low); + double root = gsl_root_fsolver_root(s); - return gsl_root_fsolver_root(s); + // free memory + gsl_root_fsolver_free(s); + + return root; }