aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-26 11:08:26 +0100
committerPedro Alves <palves@redhat.com>2016-10-26 16:21:40 +0100
commitef4a339527a41802fbab70af25d6e4788f35dcc8 (patch)
treee9b3d189b2d764aef60d017585418405659f0d09 /gdb/inferior.c
parent7b68ffbb32645c5383e74f27248a1c1c7ecd241a (diff)
downloadgdb-ef4a339527a41802fbab70af25d6e4788f35dcc8.zip
gdb-ef4a339527a41802fbab70af25d6e4788f35dcc8.tar.gz
gdb-ef4a339527a41802fbab70af25d6e4788f35dcc8.tar.bz2
gdb: Free inferior->priv when inferior exits
(Where "exits" includes being killed or detached.) Nothing is clearing inferior->priv currently. This is a problem if we change the inferior's process_stratum targets in a single debug session. This field is currently only used by darwin-nat.c, but a follow up patch will make remote.c use it too. Without the fix, remote.c might end up mistaking the priv object allocated by darwin-nat.c with its own. (Found by inspection.) gdb/ChangeLog: 2016-10-26 Pedro Alves <palves@redhat.com> * inferior.c (exit_inferior_1): Free 'priv'.
Diffstat (limited to 'gdb/inferior.c')
-rw-r--r--gdb/inferior.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 1602483..250603c 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -253,6 +253,9 @@ exit_inferior_1 (struct inferior *inftoex, int silent)
inf->pid = 0;
inf->fake_pid_p = 0;
+ xfree (inf->priv);
+ inf->priv = NULL;
+
if (inf->vfork_parent != NULL)
{
inf->vfork_parent->vfork_child = NULL;