On 11/09/2015 02:40 AM, Prasanna Kumar Kalever wrote: >>> Can some one help me please ? >>> This leads to crash in the second iteration i.e. while freeing >>> "gconf->servers->next->value" >> >> So, prior to this you allocate a array of the data structures as: >> >> + gsconf = g_new0(GlusterServer, num_servers); This is wrong. When using GlusterServerList, you call g_new0(GlusterServer, 1) once per element of the list, linking the list together incrementally, instead of trying to array-allocate the whole list at once. >> Then you use the following code to fill the linked list: >> >> + if (gconf->servers == NULL) { >> + gconf->servers = g_new0(GlusterServerList, 1); >> + gconf->servers->value = &gsconf[i]; Here is where you should be allocating value one element at a time, rather than trying to point it into pre-allocated storage. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org