[02/12] Remove remaining cleanup from breakpoint.c

Message ID 20190109033426.16062-3-tom@tromey.com
State New
Headers show
Series
  • remove some cleanups using a cleanup function
Related show

Commit Message

Tom Tromey Jan. 9, 2019, 3:34 a.m.
The remaining null cleanup in breakpoint.c does not seem to protect
anything, so remove it.

gdb/ChangeLog
2019-01-08  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (create_breakpoint): Remove cleanup.
---
 gdb/ChangeLog    |  4 ++++
 gdb/breakpoint.c | 11 -----------
 2 files changed, 4 insertions(+), 11 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 24ba4071ff..3acb5145b9 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9236,7 +9236,6 @@  create_breakpoint (struct gdbarch *gdbarch,
 		   unsigned flags)
 {
   struct linespec_result canonical;
-  struct cleanup *bkpt_chain = NULL;
   int pending = 0;
   int task = 0;
   int prev_bkpt_count = breakpoint_count;
@@ -9286,12 +9285,6 @@  create_breakpoint (struct gdbarch *gdbarch,
   if (!pending && canonical.lsals.empty ())
     return 0;
 
-  /* ----------------------------- SNIP -----------------------------
-     Anything added to the cleanup chain beyond this point is assumed
-     to be part of a breakpoint.  If the breakpoint create succeeds
-     then the memory is not reclaimed.  */
-  bkpt_chain = make_cleanup (null_cleanup, 0);
-
   /* Resolve all line numbers to PC's and verify that the addresses
      are ok for the target.  */
   if (!pending)
@@ -9390,10 +9383,6 @@  create_breakpoint (struct gdbarch *gdbarch,
       prev_breakpoint_count = prev_bkpt_count;
     }
 
-  /* That's it.  Discard the cleanups for data inserted into the
-     breakpoint.  */
-  discard_cleanups (bkpt_chain);
-
   /* error call may happen here - have BKPT_CHAIN already discarded.  */
   update_global_location_list (UGLL_MAY_INSERT);