[libc-commits] [libc] [libc] Fix memory leak in MPFR cospif with MPFR pre 4.2. (PR #114415)
via libc-commits
libc-commits at lists.llvm.org
Thu Oct 31 08:14:29 PDT 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/114415
None
>From 33e06faba713f75b94a1f8bddb3ced95eecb7f8e Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Thu, 31 Oct 2024 15:11:37 +0000
Subject: [PATCH] [libc] Fix memory leak in MPFR cospif with MPFR pre 4.2.
---
libc/utils/MPFRWrapper/MPFRUtils.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 60e4abadb5e3c8..4fa6d2f9291993 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -262,6 +262,7 @@ class MPFRNumber {
int d = mpz_tstbit(integer, 0);
mpfr_set_si(result.value, d ? -1 : 1, mpfr_rounding);
+ mpz_clear(integer);
return result;
}
@@ -271,7 +272,7 @@ class MPFRNumber {
mpfr_cos(result.value, value_pi.value, mpfr_rounding);
return result;
-#endif
+// #endif
}
MPFRNumber erf() const {
More information about the libc-commits
mailing list