From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 29 16:22:23 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0199316A403 for ; Thu, 29 Jun 2006 16:22:23 +0000 (UTC) (envelope-from hnazfoo@googlemail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DB0D43D48 for ; Thu, 29 Jun 2006 16:22:21 +0000 (GMT) (envelope-from hnazfoo@googlemail.com) Received: by nf-out-0910.google.com with SMTP id x4so97135nfb for ; Thu, 29 Jun 2006 09:22:20 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:date:from:to:subject:message-id:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=TjYZCi4vBbOGaJMA6s6FEOgl6rKH36JCVRavbwZZ2w2x4OwxAKES0c8SxPRfr2ZFAVKx0F1kZPryTPoosNC7y9y+9F1WSEjuTzKA2WrQ37809FmFIHuqxNAY3c7vMEIryrsXza0k2BEp7FKJgypITqyhY21qwD7TnuNxG/fT/wo= Received: by 10.49.41.10 with SMTP id t10mr508127nfj; Thu, 29 Jun 2006 09:22:20 -0700 (PDT) Received: from localhost ( [217.65.22.47]) by mx.gmail.com with ESMTP id x1sm705556nfb.2006.06.29.09.22.18; Thu, 29 Jun 2006 09:22:20 -0700 (PDT) Date: Thu, 29 Jun 2006 18:23:19 +0200 From: Johannes Weiner To: freebsd-hackers@freebsd.org Message-ID: <20060629162319.GA94921@leiferikson.flosken.lan> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20060628181045.GA54915@curry.mchp.siemens.de> <20060629054222.GA92895@leiferikson.flosken.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: mutt-ng/devel-r804 (FreeBSD) Subject: Re: Return value of malloc(0) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2006 16:22:23 -0000 On Thu, Jun 29, 2006 at 06:09:37PM +0200, Matthias Andree wrote: > The value returned from malloc(0) must not be dereferenced whatever it > was. It was 0x800, which doesn't count as "failure". But this would be appropriate for catching the error: if ((foo = malloc(0)) == foo) /* make noise */ wouldn't it? Hannes -- If the telephone rang today, water it!