[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/12] linux-user: Load symbols from the interpr
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH 07/12] linux-user: Load symbols from the interpreter. |
Date: |
Wed, 28 Jul 2010 00:39:39 +0400 (MSD) |
User-agent: |
Alpine 2.00 (LNX 1167 2008-08-23) |
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 <stdio.h>
#include <stdlib.h>
int main (void)
{
void *ptr;
for (;;) {
ptr = malloc (2);
if (!ptr) break;
}
printf ("result = %p\n", realloc (ptr, 1));
return 0;
}
realloc$ \time -v ./a.out
result = (nil)
Command being timed: "./a.out"
User time (seconds): 5.62
[..snip..]
> That said, I'd be happy enough to eliminate the call entirely.
--
mailto:address@hidden
[Qemu-devel] [PATCH 04/12] linux-user: Reduce lseek+reads while loading elf files., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 09/12] linux-user: Put the stack guard page at the top., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 01/12] linux-user: Handle filesz < memsz for any PT_LOAD segment., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 11/12] linux-user: Extract load_elf_image from load_elf_interp., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 12/12] linux-user: Re-use load_elf_image for the main binary., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 03/12] linux-user: Reindent elfload.c., Richard Henderson, 2010/07/27