This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] for PR26327


Hello,

The following patch fixes the reported memory leaks. I also noticed the fix by Sebastian Pop, for a memory leak
in gcc/tree-if-conv.c (ignored from this patch).

Bootstrapped on powerpc64-linux. Testing (make check) showed no new regressions.

Thanks,

Uttam

2006-02-16  Uttam Pawar  <uttamp@us.ibm.com>

        PR other/26327
        * ipa-inline.c (cgraph_early_inlining): Allocate is done
        after the sorrycount and errorcount check.
        * loop-unroll.c (referenced_in_one_insn_in_loop_p): Free
        pointer 'body'.
        * cfgloop.c (cancel_loop): Free bbs pointer.
        * collect2.c (prefix_from_string): Free nstore pointer.
        * reload1.c (fix_abnormal_edges): Free blocks pointer.

Index: gcc/ipa-inline.c
===================================================================
*** gcc/ipa-inline.c    (revision 111144)
--- gcc/ipa-inline.c    (working copy)
*************** cgraph_early_inlining (void)
*** 1137,1148 ****
  {
    struct cgraph_node *node;
    int nnodes;
!   struct cgraph_node **order =
!     XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
    int i;

    if (sorrycount || errorcount)
      return;
  #ifdef ENABLE_CHECKING
    for (node = cgraph_nodes; node; node = node->next)
      gcc_assert (!node->aux);
--- 1137,1150 ----
  {
    struct cgraph_node *node;
    int nnodes;
!   struct cgraph_node **order;
    int i;

    if (sorrycount || errorcount)
      return;
+
+   order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
+
  #ifdef ENABLE_CHECKING
    for (node = cgraph_nodes; node; node = node->next)
      gcc_assert (!node->aux);

Index: gcc/loop-unroll.c
===================================================================
*** gcc/loop-unroll.c   (revision 111144)
--- gcc/loop-unroll.c   (working copy)
*************** referenced_in_one_insn_in_loop_p (struct
*** 1532,1537 ****
--- 1532,1538 ----
            count_ref++;
        }
      }
+   free (body);
    return (count_ref  == 1);
  }

Index: gcc/cfgloop.c
===================================================================
*** gcc/cfgloop.c       (revision 111144)
--- gcc/cfgloop.c       (working copy)
*************** cancel_loop (struct loops *loops, struct
*** 1033,1038 ****
--- 1033,1040 ----

    /* Free loop data.  */
    flow_loop_free (loop);
+
+   free (bbs);
  }

  /* Cancels LOOP and all its subloops.  */

Index: gcc/collect2.c
===================================================================
*** gcc/collect2.c      (revision 111144)
--- gcc/collect2.c      (working copy)
*************** prefix_from_string (const char *p, struc
*** 728,733 ****
--- 728,735 ----
        else
        endp++;
      }
+
+   free (nstore);
  }
  ^L
  /* Main program.  */

Index: gcc/reload1.c
===================================================================
*** gcc/reload1.c       (revision 111144)
--- gcc/reload1.c       (working copy)
*************** fixup_abnormal_edges (void)
*** 8342,8347 ****
--- 8342,8348 ----
        blocks = sbitmap_alloc (last_basic_block);
        sbitmap_ones (blocks);
        find_many_sub_basic_blocks (blocks);
+       sbitmap_free (blocks);
      }

    if (inserted)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]