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]

Re: Memory leak patch-I


Hi,

This is a complete patch which fixes 3 more memory leaks. One of the
patch in gensupport.c is modified as per the suggestion by Andrew Pinski
(removed null check-if statement before freeing p_false pointer) .

Bootstrapped and regtested on powerpc64-linux. No new regressions.

Thanks in advance for reviewing it.

Uttam

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

        * gensupport.c (identify_predicable_attribute): Free
        p_false pointer.
        * gcov.c (create_file_names): Free name pointer.
        * bt-load.c (augment_live_range): Free tos pointer.

Index: gcc/gensupport.c
===================================================================
*** gcc/gensupport.c    (revision 111144)
--- gcc/gensupport.c    (working copy)
*************** identify_predicable_attribute (void)
*** 464,469 ****
--- 464,470 ----
        message_with_line (elem->lineno,
                         "attribute `predicable' is not a boolean");
        errors = 1;
+       free (p_false);
        return;
      }
    p_true[-1] = '\0';
*************** identify_predicable_attribute (void)
*** 481,492 ****
--- 482,495 ----
        message_with_line (elem->lineno,
                         "attribute `predicable' cannot be const");
        errors = 1;
+       free (p_false);
        return;

      default:
        message_with_line (elem->lineno,
                         "attribute `predicable' must have a constant default");
        errors = 1;
+       free (p_false);
        return;
      }

*************** identify_predicable_attribute (void)
*** 501,506 ****
--- 504,511 ----
                         value);
        errors = 1;
      }
+
+   free (p_false);
  }

  /* Return the number of alternatives in constraint S.  */
Index: gcc/gcov.c
===================================================================
*** gcc/gcov.c  (revision 111144)
--- gcc/gcov.c  (working copy)
*************** create_file_names (const char *file_name
*** 658,663 ****
--- 658,664 ----
    strcpy (da_file_name, name);
    strcpy (da_file_name + length, GCOV_DATA_SUFFIX);

+   free (name);
    return;
  }

Index: gcc/bt-load.c
===================================================================
*** gcc/bt-load.c       (revision 111144)
--- gcc/bt-load.c       (working copy)
*************** augment_live_range (bitmap live_range, H
*** 911,916 ****
--- 911,917 ----
        {
          if (full_range)
            IOR_HARD_REG_SET (*btrs_live_in_range, btrs_live[new_bb->index]);
+         free (tos);
          return;
        }
        *tos++ = new_bb;


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