On Wed, Nov 27, 2002 at 10:08:14PM +0000, Angus Leeming wrote:

> Can't see nothing wrong with this...
> 
> void fl_set_object_label(FL_OBJECT * ob, const char *label) {
>       ...
>       if (!label)
>               label = "";
>       ...
>       ob->label = fl_realloc(ob->label, strlen(label) + 1);
>       strcpy(ob->label, label);
> }

realloc(b, size)
{
        free(b);
        b = malloc(size);
}

        char * blah = "something";
        realloc(blah, sizeof("somethingelse"));

you cannot free string literals

> However, in your backtrace can I draw your attention to "oldsize" in item 6
> #6  0x40414114 in chunk_realloc (ar_ptr=0x404b4680, oldp=0x8418c04, 
> oldsize=4294967292, nb=16) at malloc.c:3390

consequence of the block not being found in the malloc allocation lists
(because it was never malloc()d)

john

-- 
"Millions of fingers! Millions of thumbs!
 Millions of monkeys Drumming on drums!"

Reply via email to