From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75186 invoked by alias); 3 Nov 2015 17:36:55 -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 75176 invoked by uid 89); 3 Nov 2015 17:36:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 03 Nov 2015 17:36:54 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 347082965E; Tue, 3 Nov 2015 12:36:52 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id F3jpOblOq-bH; Tue, 3 Nov 2015 12:36:52 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0EE4C285D6; Tue, 3 Nov 2015 12:36:51 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 7296846D91; Tue, 3 Nov 2015 09:36:50 -0800 (PST) Date: Tue, 03 Nov 2015 17:36:00 -0000 From: Joel Brobecker To: Ulrich Weigand Cc: Marcin =?utf-8?Q?Ko=C5=9Bcielnicki?= , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/record-full: Use xmalloc instead of alloca for large buffers. Message-ID: <20151103173650.GF4009@adacore.com> References: <1446489704-3173-1-git-send-email-koriakin@0x04.net> <20151103173055.424DAF82F@oc7340732750.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151103173055.424DAF82F@oc7340732750.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-11/txt/msg00123.txt.bz2 > > gdb/ChangeLog: > > > > * record-full.c (record_full_exec_insn): Use xmalloc for large buffers. > > I think this may leak memory if some code between the xmalloc and the xfree > throws a GDB exception. Usually, this is protected against by calling the > xfree via the make_cleanup mechanism ... Also, why not just call xmalloc every time instead of doing a combination of alloca and xmalloc? I don't see enough benefits to justify the extra complication. -- Joel