[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] possible attributes bug

From: Gábor Csárdi
Subject: Re: [igraph] possible attributes bug
Date: Sat, 23 Oct 2010 19:10:16 +0200

On Sat, Oct 23, 2010 at 4:19 PM, Marco Valerio Barbera
<address@hidden> wrote:
> On 23 October 2010 12:16, Gábor Csárdi <address@hidden> wrote:
>> this is indeed a bug, actually not in the attribute handling, but in
>> igraph_strvector, or maybe even in libc. realloc() should work find
>> with size=0 AFAIK, but it does not.
> I just tried the patch and it seem to work! thanks a lot
> anyway I don't get your point about the realloc. Of course it works
> with size=0, and what it does is that it probably frees() the
> allocated vector.
> from the realloc man:
> "If size was equal to 0, either NULL or a pointer suitable to be
> passed to free() is returned."
> this means that if the return value of realloc is NULL then the
> realloc just freed the memory, otherwise you have to do it by
> yourself.

Well, I think that this means that realloc returns a pointer that can
be passed to free(), but it does not itself passes it to free(). (Or
NULL is returned, which would be fine, because I handle that.)

However, this is seemingly not true, neither in glibc for your, nor in
OS X (BSD) libc for me.

No big deal, it is just good to know.



Gabor Csardi <address@hidden>     UNIL DGM

reply via email to

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