[libc-commits] [libc] [libc] Fix memory leak in MPFRWrapper cospif with MPFR pre 4.2. (PR #114415)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 31 08:15:31 PDT 2024


https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/114415

>From 27cc5c54fe3852df0d44c62f7608d16a234d248f 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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 60e4abadb5e3c8..5afc3d007d4d7a 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;
     }
 



More information about the libc-commits mailing list