Re: Strange behavior of glib



Martin Bammer <e9525103 stud4 tuwien ac at> writes:

Following code doesn't work. _name will be destroyed after the second line.
Is this a bug in glib???

    g_message("%s", _name);
    if (_name) name = g_strdown(g_strdup(_name));
    g_message("%s", _name);

The fragment above should not result in _name being destroyed, but
it's unlikely that you have found a bug in glib. 

One possibility is that you have some other bug (a double free()
perhaps) in your program causing the malloc() in g_strdup() to corrupt
the memory pointed to by _name.

Søren



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