From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29747 invoked by alias); 17 Dec 2003 21:05:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29543 invoked from network); 17 Dec 2003 21:05:07 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 17 Dec 2003 21:05:07 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 9CE6680018E for ; Wed, 17 Dec 2003 16:05:06 -0500 (EST) Message-ID: <3FE0C502.7020408@redhat.com> Date: Wed, 17 Dec 2003 21:05:00 -0000 From: Jeff Johnston User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [RFA]: Fix do_cleanups if oldchain is NULL Content-Type: multipart/mixed; boundary="------------070203020602030609050006" X-SW-Source: 2003-12/txt/msg00418.txt.bz2 This is a multi-part message in MIME format. --------------070203020602030609050006 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 672 I recently solved a bug on the ia64 concerning cleanups. What was happening was that a cleanup list was being re-initialized to NULL inside a loop and later do_cleanups() was called. This caused the entire cleanup list to be run because the design is to run the list until the passed in cleanup is reached. This caused other errors when the stream being used was deleted, etc... This patch adds a check to do_my_cleanups() so no cleanups will be performed if the passed in chain is NULL. Ok to commit? -- Jeff J. 2003-12-17 Jeff Johnston * utils.c (do_my_cleanups): Don't do cleanups if old chain passed in is NULL. --------------070203020602030609050006 Content-Type: text/plain; name="utils.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="utils.patch" Content-length: 794 Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.110 diff -u -p -r1.110 utils.c --- utils.c 21 Sep 2003 01:26:45 -0000 1.110 +++ utils.c 17 Dec 2003 20:35:56 -0000 @@ -316,11 +316,14 @@ do_my_cleanups (struct cleanup **pmy_cha struct cleanup *old_chain) { struct cleanup *ptr; - while ((ptr = *pmy_chain) != old_chain) + if (old_chain != NULL) { - *pmy_chain = ptr->next; /* Do this first incase recursion */ - (*ptr->function) (ptr->arg); - xfree (ptr); + while ((ptr = *pmy_chain) != old_chain) + { + *pmy_chain = ptr->next; /* Do this first incase recursion */ + (*ptr->function) (ptr->arg); + xfree (ptr); + } } } --------------070203020602030609050006--