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]

[COMMIT PATCH] gdbserver: QTNotes, plug memory leak.


The previous notes aren't being released before setting new ones.

Tested on x86_64 Fedora 17.

gdb/gdbserver/
2013-02-14  Pedro Alves  <palves@redhat.com>

	Plug memory leak.

	* tracepoint.c (cmd_qtnotes): Free TRACING_USER_NAME,
	TRACING_NOTES and TRACING_STOP_NOTE before clobbering.
---
 gdb/gdbserver/tracepoint.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 92e05ad..ea7bf66 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -4040,6 +4040,7 @@ cmd_qtnotes (char *own_buf)
 	  user[nbytes] = '\0';
 	  ++packet; /* skip the semicolon */
 	  trace_debug ("User is '%s'", user);
+	  xfree (tracing_user_name);
 	  tracing_user_name = user;
 	}
       else if (strncmp ("notes:", packet, strlen ("notes:")) == 0)
@@ -4053,6 +4054,7 @@ cmd_qtnotes (char *own_buf)
 	  notes[nbytes] = '\0';
 	  ++packet; /* skip the semicolon */
 	  trace_debug ("Notes is '%s'", notes);
+	  xfree (tracing_notes);
 	  tracing_notes = notes;
 	}
       else if (strncmp ("tstop:", packet, strlen ("tstop:")) == 0)
@@ -4066,6 +4068,7 @@ cmd_qtnotes (char *own_buf)
 	  stopnote[nbytes] = '\0';
 	  ++packet; /* skip the semicolon */
 	  trace_debug ("tstop note is '%s'", stopnote);
+	  xfree (tracing_stop_note);
 	  tracing_stop_note = stopnote;
 	}
       else


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