]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: fix two minor front-end GMP memleaks
authorHarald Anlauf <anlauf@gmx.de>
Sun, 8 Dec 2024 21:30:32 +0000 (22:30 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Mon, 9 Dec 2024 17:19:57 +0000 (18:19 +0100)
gcc/fortran/ChangeLog:

* expr.cc (find_array_section): Do not initialize GMP variables
twice.

gcc/fortran/expr.cc

index a997bdae726a1aaf57075f7ba08002d23c4d4ffa..a349d989d6c40c9c5b8159ea3250998734b62c09 100644 (file)
@@ -1613,7 +1613,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
          /* Zero-sized arrays have no shape and no elements, stop early.  */
          if (!begin->shape)
            {
-             mpz_init_set_ui (nelts, 0);
+             mpz_set_ui (nelts, 0);
              break;
            }
 
@@ -1714,7 +1714,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
      constructor.  */
   for (idx = 0; idx < (int) mpz_get_si (nelts); idx++)
     {
-      mpz_init_set_ui (ptr, 0);
+      mpz_set_ui (ptr, 0);
 
       incr_ctr = true;
       for (d = 0; d < rank; d++)