From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68882 invoked by alias); 17 Feb 2016 02:44:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 68743 invoked by uid 89); 17 Feb 2016 02:44:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=255,6, 2556, 2559, exits X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 17 Feb 2016 02:44:55 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id D308A804E7 for ; Wed, 17 Feb 2016 02:44:53 +0000 (UTC) Received: from brno.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1H2ipuJ016136 for ; Tue, 16 Feb 2016 21:44:53 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 2/5] gdb: Free inferior->priv when inferior exits Date: Wed, 17 Feb 2016 02:44:00 -0000 Message-Id: <1455677091-13683-3-git-send-email-palves@redhat.com> In-Reply-To: <1455677091-13683-1-git-send-email-palves@redhat.com> References: <1455677091-13683-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-02/txt/msg00494.txt.bz2 (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-02-16 Pedro Alves * inferior.c (exit_inferior_1): Free 'priv'. --- gdb/inferior.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/inferior.c b/gdb/inferior.c index 45b3141..083dc63 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -255,6 +255,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; -- 1.9.3