From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32356 invoked by alias); 2 Mar 2011 18:31:34 -0000 Received: (qmail 32348 invoked by uid 22791); 2 Mar 2011 18:31:34 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Mar 2011 18:31:30 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 1B7E52D015; Wed, 2 Mar 2011 10:31:29 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost2.vmware.com (Postfix) with ESMTP id 117A68EF19; Wed, 2 Mar 2011 10:31:29 -0800 (PST) Message-ID: <4D6E8D00.5000304@vmware.com> Date: Wed, 02 Mar 2011 18:31:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Pedro Alves CC: "gdb@sourceware.org" Subject: Re: question, xmalloc and gdbserver? References: <4D6D8067.9090802@vmware.com> <201103020940.21789.pedro@codesourcery.com> In-Reply-To: <201103020940.21789.pedro@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00024.txt.bz2 Pedro Alves wrote: > On Tuesday 01 March 2011 23:25:27, Michael Snyder wrote: >> What's the policy about using malloc vs. xmalloc in gdbserver? >> I notice both are used, with xmalloc being favored, but there are >> still quite a few calls to malloc. > > I think malloc is used when a failure is not to be considered > fatal, e.g., when the size of the data is determined by the input. > > Doug went through and fixed a bunch a while ago (yearly 2009). > You should be able to find the discussions around the patches > in the archives. Basically, if there's no explicit check > for NULL after malloc, then it's quite likely a new call > that went in after Doug's fixes. > OK, so you're saying that all "legitimate" calls to malloc will be checked?