glib bindings and memory management

Colin Walters walters at verbum.org
Wed May 4 13:14:34 PDT 2005


On Wed, 2005-05-04 at 16:09 -0400, Colin Walters wrote:

Of course I messed this up =)

> for (i = 0; i < arr->len; i++) {
>    FooValue *elt = &(g_array_index (arr, i]));
>    g_free (elt->name);
>    g_value_unset (elt->val);
>    g_hash_table_destroy (elt->table);
> }

Should be:

for (i = 0; i < arr->len; i++) {
   FooValue *elt = &(g_array_index (arr, i]));
   g_free (elt->name);
   g_value_unset (elt->val);
   g_hash_table_destroy (elt->table);
   g_free (elt);
}
g_array_free (arr, TRUE);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050504/d3fc5109/attachment.pgp


More information about the dbus mailing list