From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfwZQ-000781-QI for qemu-devel@nongnu.org; Thu, 01 May 2014 15:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WfwZL-0008U5-RC for qemu-devel@nongnu.org; Thu, 01 May 2014 15:23:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfwZL-0008Tw-I3 for qemu-devel@nongnu.org; Thu, 01 May 2014 15:22:55 -0400 Message-ID: <53629F0E.9040302@redhat.com> Date: Thu, 01 May 2014 13:22:54 -0600 From: Eric Blake MIME-Version: 1.0 References: <1398762656-26079-1-git-send-email-cyliu@suse.com> <1398762656-26079-14-git-send-email-cyliu@suse.com> <53629DEA.8090905@redhat.com> In-Reply-To: <53629DEA.8090905@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gPaPPJnVI6v6eOt8aN5MvSs6gV9Osxb3w" Subject: Re: [Qemu-devel] [PATCH V26 13/32] vvfat.c: handle cross_driver's create_options and create_opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu , qemu-devel@nongnu.org Cc: stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gPaPPJnVI6v6eOt8aN5MvSs6gV9Osxb3w Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/01/2014 01:18 PM, Eric Blake wrote: > On 04/29/2014 03:10 AM, Chunyan Liu wrote: >> vvfat shares create options of qcow driver. To avoid vvfat broken when= >=20 > s/broken/breaking/ >=20 >> qcow driver changes from QEMUOptionParameter to QemuOpts, let it able >> to handle both cases. >> >> + if (bdrv_qcow->create_options) { >> + create_opts =3D params_to_opts(bdrv_qcow->create_options); >=20 > allocated... >=20 >> + } else { >> + create_opts =3D bdrv_qcow->create_opts; >=20 > vs. reference... >=20 Couldn't you just do: create_opts =3D qemu_opts_append(NULL, bdrv_qcow2->create_opts, bdrv_qcow2->create_options); at which point, your blind free on cleanup will just work? >> err: >> + qemu_opts_del(opts); >> + qemu_opts_free(create_opts); >=20 > but unconditionally freed on either path. Calling > g_free(bdrv_qcow->create_opts) is not nice. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --gPaPPJnVI6v6eOt8aN5MvSs6gV9Osxb3w Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTYp8OAAoJEKeha0olJ0NqKWMH+wdtSssOqCdfU5i/cKyast2r ExAfg/gOzz1YmAmgLrrCz6Q7i12dTNtr3srOtuW/07ME7bBL8Zi722w1jFMwHXrF gIVVJMSgdCXf7QmJiNPS4WyNxUlM2V/gYT7m4ukP1UQT/xb2fRrYEWzbm3/11YFC 4gZf5V7qaUl0Iw60zsUxcEJ5W3YdKtGGyB1u2jdq9/UqYclfsip0zXPtCN1MCPaj zi+8hfTTREWUxVpX5Pd9ZMjLvp1TluljGLl5xcN833LAgByYOLci43C0VAggBkrQ bnv0ogk73bgtAzCTJ2PmnIuVV9dhl6EDFVWgspiYRgj5ZYSsK8JnOWD1Pt0YbdU= =deNh -----END PGP SIGNATURE----- --gPaPPJnVI6v6eOt8aN5MvSs6gV9Osxb3w--