cURL / Mailing Lists / curl-library / Single Mail


Re: [EXAMPLE] Bug in getinmemory.c

From: Martin Möller <>
Date: Tue, 10 May 2011 22:11:02 +0200

Am 10.05.11 21:55 schrieb "Dan Fandrich" unter <>:

> On Tue, May 10, 2011 at 09:28:46PM +0200, Martin Möller wrote:
>> Am 10.05.11 20:50 schrieb "Dan Fandrich" unter <>:
>>> If realloc changes the memory address, it is responsible for moving the
>>> contents of the old block to the new one. At worst, the code as it stands
>>> will suffer from a memory leak if the realloc fails, but it should execute
>>> fine. Are you seeing an actual problem when running the example?
>> As with FreeBSD, this is only true if you realloc() a memory block of lesser
>> size, but not for a larger one, than the previous one (which is done by
>> getinmemory). There should be garbage output on such systems.
>> Man Page of realloc() on FreeBSD:
>> =FreeBSD+8.2-RELEASE&format=html
> "The contents of the memory are unchanged up to the lesser of the new and
> old sizes."

"If the new size is larger, the contents of the newly allocated portion of
the memory are undefined."

>>>> Dan
> -------------------------------------------------------------------
> List admin:
> Etiquette:

List admin:
Received on 2011-05-10