aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-02-14 18:07:19 +0000
committerPedro Alves <palves@redhat.com>2013-02-14 18:07:19 +0000
commit8e1d55a3dfe0d11fcc0921d97a80dc280a1af06b (patch)
treeaa2125e6acd21b945893e64767ac0cc4dc627153
parent458820da59b112e977d02e66163fb706a874f721 (diff)
downloadgdb-8e1d55a3dfe0d11fcc0921d97a80dc280a1af06b.zip
gdb-8e1d55a3dfe0d11fcc0921d97a80dc280a1af06b.tar.gz
gdb-8e1d55a3dfe0d11fcc0921d97a80dc280a1af06b.tar.bz2
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.
-rw-r--r--gdb/gdbserver/ChangeLog7
-rw-r--r--gdb/gdbserver/tracepoint.c3
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 07bd1a8..3b2239f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2013-02-14 Pedro Alves <palves@redhat.com>
+
* tracepoint.c (cmd_qtdpsrc): Use savestring.
2013-02-14 Pedro Alves <palves@redhat.com>
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 0ffedaa..95c55ad 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -4042,6 +4042,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)
@@ -4055,6 +4056,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)
@@ -4068,6 +4070,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