From owner-freebsd-stable@FreeBSD.ORG Fri Jul 25 15:13:41 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 648AE37B401 for ; Fri, 25 Jul 2003 15:13:41 -0700 (PDT) Received: from solfertje.student.utwente.nl (solfertje.student.utwente.nl [130.89.167.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id D17E743FA3 for ; Fri, 25 Jul 2003 15:13:40 -0700 (PDT) (envelope-from dalroi@solfertje.student.utwente.nl) Received: from solfertje.student.utwente.nl (failways.internal [10.236.150.2]) by solfertje.student.utwente.nl (Postfix) with ESMTP id 21516376; Sat, 26 Jul 2003 00:16:44 +0200 (CEST) Date: Sat, 26 Jul 2003 00:13:28 +0200 (CEST) From: Alban Hertroys To: Pete French In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Message-Id: <20030725221644.21516376@solfertje.student.utwente.nl> cc: freebsd-stable@freebsd.org Subject: Re: malloc does not return null when out of memory X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Alban Hertroys List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jul 2003 22:13:41 -0000 On 24 Jul, Pete French punched keys in this particular order: > Its not bogus - the trouble is that you cant tell at the time malloc returns > whether the pointer will be useable or not. You only find that out when > you try and use it, and whether theres any space or not depends oon what > else may have munched up (or released) memory between you making the call > to malloc() and actually writing to the location returned. This looks similar to the problem with mktemp(). Maybe it is possible to solve this in a similar way? For example, by allocating memory and filling it in the same call? That probably would mean that all the software should switch to a new way of allocating memory, but it's a start... -- Alban Hertroys http://solfertje.student.utwente.nl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This person has performed an illegal operation and will be shot down.