From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvtio-0002Tr-Tr for qemu-devel@nongnu.org; Mon, 09 Nov 2015 16:11:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvtij-0005Fs-Ul for qemu-devel@nongnu.org; Mon, 09 Nov 2015 16:11:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvtij-0005Fa-Pb for qemu-devel@nongnu.org; Mon, 09 Nov 2015 16:11:21 -0500 References: <1446727026-18094-1-git-send-email-prasanna.kalever@redhat.com> <1446727026-18094-2-git-send-email-prasanna.kalever@redhat.com> <1677110309.4230186.1446727550535.JavaMail.zimbra@redhat.com> <20151109070445.GF3391301@andariel.pipo.sk> <2024052690.6797703.1447062009061.JavaMail.zimbra@redhat.com> From: Eric Blake Message-ID: <56410BF7.6050502@redhat.com> Date: Mon, 9 Nov 2015 14:11:19 -0700 MIME-Version: 1.0 In-Reply-To: <2024052690.6797703.1447062009061.JavaMail.zimbra@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lAQmBfP7ELPUW2UFW09Fpj0uVd1M5WnmB" Subject: Re: [Qemu-devel] [PATCH 3/3] block/gluster: add support for multiple gluster servers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Prasanna Kumar Kalever , Peter Krempa Cc: kwolf@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, deepakcs@redhat.com, bharata@linux.vnet.ibm.com, rtalur@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lAQmBfP7ELPUW2UFW09Fpj0uVd1M5WnmB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 =3D 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 =3D=3D NULL) { >> + gconf->servers =3D g_new0(GlusterServerList, 1); >> + gconf->servers->value =3D &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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lAQmBfP7ELPUW2UFW09Fpj0uVd1M5WnmB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWQQv3AAoJEKeha0olJ0NqMEgH/1Js5AkjbtCANG46Ko39bLCq apeBHsnYvM6Pn4xi+xjPpqErpGsYEOmpugGcgmJXeQSIMSlOSVoiKp5VuDIA9dCC 4K7nofXWqq84EL2el12c6R0X6wBeCzPezKOlJEHzUDXFEdeqau5Z6BYGs1NIFtXf FExznPMCCxlV9ZsZD+gYvXVmi3czfdsWq3yzmcGB0349rE3G3Z8MXKYvpM456lb6 ZnJja7msX2tjUdd/5OKA95seT5RPJWUyD8vRH63avwIBHRmnL6nLIgwxd3DN2Ajw Uq6JCo2Qw8h+8j00nVCmYTmeNJ5LU6GzTzavZoMgqp6gtIlee24iRfUbYOgjjWw= =C6hg -----END PGP SIGNATURE----- --lAQmBfP7ELPUW2UFW09Fpj0uVd1M5WnmB--