From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17958 invoked by alias); 5 Jun 2013 20:23:24 -0000 Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org Received: (qmail 17922 invoked by uid 89); 5 Jun 2013 20:23:17 -0000 X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_BT,TW_DB 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; Wed, 05 Jun 2013 20:23:16 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r55KNFgZ008612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Jun 2013 16:23:15 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r55KNDfk013752 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Wed, 5 Jun 2013 16:23:14 -0400 Message-ID: <51AF9E31.3060804@redhat.com> Date: Wed, 05 Jun 2013 20:23:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: insight Subject: [PATCH] Fix cleanups Content-Type: multipart/mixed; boundary="------------070903010402080808020000" X-Virus-Found: No X-SW-Source: 2013-q2/txt/msg00015.txt.bz2 This is a multi-part message in MIME format. --------------070903010402080808020000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 476 Hi, Gdb now asserts on dangling cleanups left in the code, so I've taken the time to audit the gdbtk code to make sure that cleanups are handled correctly. I've committed the attached patch. Keith ChangeLog 2013-06-05 Keith Seitz * generic/gdbtk.c (tk_command): Use xfree instead of free. * generic/gdbtk-hooks.c (gdbtk_call_command): Remove unused cleanup. * generic/gdbtk-cmds.c (gdb_load_info): If bfd_check_format fails, run the cleanup. --------------070903010402080808020000 Content-Type: text/x-patch; name="cleanups.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cleanups.patch" Content-length: 2898 Index: generic/gdbtk.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -p -r1.53 -r1.54 --- generic/gdbtk.c 30 Mar 2012 07:04:59 -0000 1.53 +++ generic/gdbtk.c 5 Jun 2013 20:19:46 -0000 1.54 @@ -1,5 +1,5 @@ /* Startup code for Insight - Copyright (C) 1994-2012 Free Software Foundation, Inc. + Copyright (C) 1994-2013 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -739,7 +739,7 @@ tk_command (char *cmd, int from_tty) result = xstrdup (Tcl_GetStringResult (gdbtk_interp)); - old_chain = make_cleanup (free, result); + old_chain = make_cleanup (xfree, result); if (retval != TCL_OK) error ("%s", result); Index: generic/gdbtk-hooks.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -p -r1.58 -r1.59 --- generic/gdbtk-hooks.c 10 Nov 2012 17:49:57 -0000 1.58 +++ generic/gdbtk-hooks.c 5 Jun 2013 20:19:46 -0000 1.59 @@ -1,7 +1,7 @@ /* Startup code for Insight. Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002, 2003, 2004, - 2008, 2010, 2011, 2012 Free Software Foundation, Inc. + 2008, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -528,9 +528,6 @@ static void gdbtk_call_command (struct cmd_list_element *cmdblk, char *arg, int from_tty) { - struct cleanup *old_chain; - - old_chain = make_cleanup (null_cleanup, 0); running_now = 0; if (cmdblk->class == class_run || cmdblk->class == class_trace) { @@ -545,8 +542,6 @@ gdbtk_call_command (struct cmd_list_elem } else cmd_func (cmdblk, arg, from_tty); - - do_cleanups (old_chain); } /* Called after a `set' command succeeds. Runs the Tcl hook Index: generic/gdbtk-cmds.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v retrieving revision 1.131 retrieving revision 1.132 diff -u -p -r1.131 -r1.132 --- generic/gdbtk-cmds.c 13 Apr 2013 17:01:11 -0000 1.131 +++ generic/gdbtk-cmds.c 5 Jun 2013 20:19:46 -0000 1.132 @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight. - Copyright (C) 1994-2012 Free Software Foundation, Inc. + Copyright (C) 1994-2013 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. Substantially augmented by Martin Hunt, Keith Seitz & Jim Ingham of @@ -969,6 +969,7 @@ gdb_load_info (ClientData clientData, Tc if (!bfd_check_format (loadfile_bfd, bfd_object)) { + do_cleanups (old_cleanups); gdbtk_set_result (interp, "Bad Object File"); return TCL_ERROR; } --------------070903010402080808020000--