Re: possible g_hash_table mem leak?

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

 



On Tue, 4 Jan 2005 16:04:23 +0000, Eli Yukelzon <reflog@xxxxxxxxx> wrote:
> Hi there.
> I've stumbled uppon some weird behavior of g_hash_table, maybe some
> one can tell me if I wrong with this, or is this a real memory leak.
> Here's a little c prog that demonstrates the problem:
> ====================
> #include <glib.h>
> void main(){
>         GHashTable * h= g_hash_table_new_full  (
> g_str_hash,g_str_equal, g_free,g_free);
>         char *a,*b,*c,*d,*e,*f;
>         asprintf(&a,"a");
>         asprintf(&b,"b");
>         g_hash_table_insert(h,a,b);
>         g_hash_table_destroy (h);
> }
> ====================

Your problem is probably that you are combining asprintf() with g_free(),
using g_strdup_printf should give you better results.

Cheers,
                                              -Tristan
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux