From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EXNIy-0008JS-OB for mharc-grub-devel@gnu.org; Wed, 02 Nov 2005 13:25:48 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EXNIw-0008Gu-Nz for grub-devel@gnu.org; Wed, 02 Nov 2005 13:25:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EXNIv-0008F1-3B for grub-devel@gnu.org; Wed, 02 Nov 2005 13:25:46 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EXNIu-0008Ev-WF for grub-devel@gnu.org; Wed, 02 Nov 2005 13:25:45 -0500 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EXNIu-0001MO-Ua for grub-devel@gnu.org; Wed, 02 Nov 2005 13:25:45 -0500 Received: from vscan-cn.han.nl (venus.han.nl [145.74.65.6]) by mail-cn.han.nl (Postfix) with ESMTP id 1413B833B for ; Wed, 2 Nov 2005 19:25:44 +0100 (CET) Received: from mail-cn.han.nl ([145.74.66.11]) by vscan-cn.han.nl (venus.han.nl [145.74.65.6]) (amavisd-new, port 10024) with ESMTP id 27625-03 for ; Wed, 2 Nov 2005 19:25:42 +0100 (CET) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id 5B5928919 for ; Wed, 2 Nov 2005 19:25:42 +0100 (CET) Received: from localhost.localdomain (mgerards.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id EA4C1C04A for ; Wed, 2 Nov 2005 19:25:41 +0100 (CET) Mail-Copies-To: metgerards@student.han.nl To: grub-devel@gnu.org From: Marco Gerards Date: Wed, 02 Nov 2005 19:25:46 +0100 Message-ID: <87acgmhpp1.fsf@student.han.nl> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (2.2.0) at vscan-cn.han.nl Subject: Bison error handling X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2005 18:25:46 -0000 Hi, Hopefully any of you have either a clue about bison or an idea how to solve this problem. What happens now is that during parsing memory is allocated. If everything is parsed there is a set of malloc'ed memory all pointing to each other, etc. The main problem is in case of a syntax error. In that case all of the state should be released (free all memory structures). But I have no idea how to do that; yyparse just returns an error. I need a way to make bison return a valid structure so I can check if parsing failed and release all of the memory. One solution to this problem is making a big list of all memory allocated while scanning and parsing. When parsing fails you just free all of this memory. Otherwise everything is freed when the datastructures are about to be de-allocated. But I prefer a solution using bison stuff, otherwise I'll just use the solution I described above. -- Marco