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

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


Author: lntue
Date: 2024-10-31T11:19:54-04:00
New Revision: 296a9ba77d46018ddfa4f8bf379ada319acdf372

URL: https://github.com/llvm/llvm-project/commit/296a9ba77d46018ddfa4f8bf379ada319acdf372
DIFF: https://github.com/llvm/llvm-project/commit/296a9ba77d46018ddfa4f8bf379ada319acdf372.diff

LOG: [libc] Fix memory leak in MPFRWrapper cospif with MPFR pre 4.2. (#114415)

Added: 
    

Modified: 
    libc/utils/MPFRWrapper/MPFRUtils.cpp

Removed: 
    


################################################################################
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