From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoLwr-0001NN-Re for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoLwm-00084h-P0 for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:33:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoLwm-00084H-GA for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:33:36 -0500 Message-ID: <529FBBCB.3000505@redhat.com> Date: Wed, 04 Dec 2013 16:33:31 -0700 From: Eric Blake MIME-Version: 1.0 References: <1386077165-19577-1-git-send-email-benoit@irqsave.net> <1386077165-19577-3-git-send-email-benoit@irqsave.net> In-Reply-To: <1386077165-19577-3-git-send-email-benoit@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GdrK7cxskd7orEKqeuDAcOAX20AvRJuSb" Subject: Re: [Qemu-devel] [RFC V3 2/7] block: Allow the user to define "node-name" option. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, armbru@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GdrK7cxskd7orEKqeuDAcOAX20AvRJuSb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/03/2013 06:26 AM, Beno=C3=AEt Canet wrote: > Signed-off-by: Benoit Canet > --- > block.c | 42 +++++++++++++++++++++++++++++++++++++----- > 1 file changed, 37 insertions(+), 5 deletions(-) >=20 > @@ -880,7 +881,14 @@ int bdrv_file_open(BlockDriverState **pbs, const c= har *filename, > options =3D qdict_new(); > } > =20 > - bs =3D bdrv_new("", ""); > + node_name =3D qdict_get_try_str(options, "node-name"); > + if (node_name && bdrv_find_node(node_name)) { > + error_setg(errp, "Duplicate node name"); > + return -EINVAL; This leaks options on failure. > @@ -1053,6 +1070,21 @@ int bdrv_open(BlockDriverState *bs, const char *= filename, QDict *options, > options =3D qdict_new(); > } > =20 > + node_name =3D qdict_get_try_str(options, "node-name"); > + if (node_name && bdrv_find_node(node_name)) { > + error_setg(errp, "Duplicate node name"); > + return -EINVAL; So does this. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GdrK7cxskd7orEKqeuDAcOAX20AvRJuSb 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.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSn7vLAAoJEKeha0olJ0NqjSIH/RV1RK0IBy7nv7zpcU4xHRtO hei40G0SoxikACzsP6ihv5DzxaCoQh8GYhdi7Fgl4wO+LKNojjyVnFAZ1Hf89x01 LjtWhlNY10bYZwqf/u6StSS6KOkJxqrZafhY7akESxYAh32KE2WXf+fVVsxxdKb5 9ay8PaDQeRiaFs34/ACejlxGFolP6QzVnUNphZcmN1KTfthTWf0mhYq4x3gDs2dw AI7lFU6+kV+hF63OsA+wbkjFK8OP0Y+eT/LmgsXGQ3PfKLhzYItry6mHrb0vYjo+ eKbDCfCD+2QSCmlbU4KyPUqCanvcb2YnLJQo127pg+WxVZJWvPg4rRY8I3VsSW8= =WhfQ -----END PGP SIGNATURE----- --GdrK7cxskd7orEKqeuDAcOAX20AvRJuSb--