From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16095 invoked by alias); 9 May 2013 18:51:03 -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 16083 invoked by uid 89); 9 May 2013 18:51:03 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_RG autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 18:51:02 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49Ip16R018119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 May 2013 14:51:01 -0400 Received: from barimba (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r49IouiB019707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 9 May 2013 14:51:00 -0400 From: Tom Tromey From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 09/40] cleanup fixes for remote-mips.c In-Reply-To: References: Message-Id: <36cafe4607fda38a06212cbdb7de1723d1da6f57.1368124285.git.tromey@redhat.com> Date: Thu, 09 May 2013 18:51:00 -0000 MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00323.txt.bz2 remote-mips.c has a few 'return's where cleanups are not run. * remote-mips.c (mips_exit_debug): Call do_cleanups on all return paths. (mips_initialize): Likewise. (common_open): Call do_cleanups. --- gdb/remote-mips.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 3b65b59..1619622 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1386,13 +1386,19 @@ mips_exit_debug (void) mips_request ('x', 0, 0, NULL, mips_receive_wait, NULL); mips_need_reply = 0; if (!mips_expect (" break!")) - return -1; + { + do_cleanups (old_cleanups); + return -1; + } } else mips_request ('x', 0, 0, &err, mips_receive_wait, NULL); if (!mips_expect (mips_monitor_prompt)) - return -1; + { + do_cleanups (old_cleanups); + return -1; + } do_cleanups (old_cleanups); @@ -1406,7 +1412,7 @@ static void mips_initialize (void) { int err; - struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL); + struct cleanup *old_cleanups; int j; /* What is this code doing here? I don't see any way it can happen, and @@ -1419,6 +1425,8 @@ mips_initialize (void) return; } + old_cleanups = make_cleanup (mips_initialize_cleanups, NULL); + mips_wait_flag = 0; mips_initializing = 1; @@ -1543,6 +1551,7 @@ common_open (struct target_ops *ops, char *name, int from_tty, char *remote_name = 0; char *local_name = 0; char **argv; + struct cleanup *cleanup; if (name == 0) error (_("\ @@ -1558,7 +1567,7 @@ seen from the board via TFTP, specify that name as the third parameter.\n")); /* Parse the serial port name, the optional TFTP name, and the optional local TFTP name. */ argv = gdb_buildargv (name); - make_cleanup_freeargv (argv); + cleanup = make_cleanup_freeargv (argv); serial_port_name = xstrdup (argv[0]); if (argv[1]) /* Remote TFTP name specified? */ @@ -1655,6 +1664,8 @@ seen from the board via TFTP, specify that name as the third parameter.\n")); stop_pc = regcache_read_pc (get_current_regcache ()); print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC); xfree (serial_port_name); + + do_cleanups (cleanup); } /* Open a connection to an IDT board. */ -- 1.8.1.4