This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH] Use delete instead of xfree for gdb_timer


On 2017-05-31 16:47, Simon Marchi wrote:
gdb_timer objects are new'ed in create_timer, but xfree'd in
poll_timers.  Use delete instead.

gdb/ChangeLog:

	* event-loop.c (poll_timers): Unallocate timer using delete
	instead of xfree.
---
 gdb/event-loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 4b3ddb8..7304ca7 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -1270,7 +1270,7 @@ poll_timers (void)
       /* Delete the timer before calling the callback, not after, in
 	 case the callback itself decides to try deleting the timer
 	 too.  */
-      xfree (timer_ptr);
+      delete timer_ptr;

       /* Call the procedure associated with that timer.  */
       (proc) (client_data);

I pushed this in.

Simon


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