Hi Chen, On Wed, Mar 28, 2012, chen.ganir@xxxxxx wrote: > +static void char_free(gpointer user_data) > +{ > + struct characteristic *c = user_data; > + > + g_free(c); > +} > + > static void deviceinfo_free(gpointer user_data) > { > struct deviceinfo *d = user_data; > @@ -55,7 +71,11 @@ static void deviceinfo_free(gpointer user_data) > if (d->attrib != NULL) > g_attrib_unref(d->attrib); > > + if (d->chars != NULL) > + g_slist_free_full(d->chars, char_free); You don't need to check for NULL before calling g_slist_free_full since NULL is a valid GSList (signifying an empty list). You also don't really need the char_free function but could simply do: g_slist_free_full(d->chars, g_free); Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html