From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45151 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Odr1G-0000Uq-Qi for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:45:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Odr1F-0000L0-LD for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:44:58 -0400 Received: from fe02x03-cgp.akado.ru ([77.232.31.165]:64186 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Odr1F-0000Ke-D9 for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:44:57 -0400 Date: Wed, 28 Jul 2010 00:44:17 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] [PATCH 07/12] linux-user: Load symbols from the interpreter. In-Reply-To: Message-ID: References: <1280251538-6860-1-git-send-email-rth@twiddle.net> <1280251538-6860-8-git-send-email-rth@twiddle.net> <4C4F3AB3.5050900@twiddle.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org On Wed, 28 Jul 2010, malc wrote: > On Tue, 27 Jul 2010, Richard Henderson wrote: > > > On 07/27/2010 11:45 AM, malc wrote: > > >> + syms = realloc(syms, nsyms * sizeof(*syms)); > > > > > > Realloc can fail here. > > > > I don't believe it can. This (pre-existing) statement *reduces* > > the existing allocation of syms. I'd be surprised if any malloc > > implementation fails on a size reduction. > > Life is full of surprises. > > realloc$ cat tr.c > #include > #include > > int main (void) > { > void *ptr; > > for (;;) { > ptr = malloc (2); > if (!ptr) break; > } > printf ("result = %p\n", realloc (ptr, 1)); > return 0; > } Uh, appologies, this doesn't quite do what i thought it should, final realloc allocates without freeing. Guess i have to spend more time trying to prove that i'm the smartest kid on the block. -- mailto:av1474@comtv.ru