qemu-devel
[Top][All Lists]
Advanced

[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:44:17 +0400 (MSD)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

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 <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;
> }

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:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]