From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPcBZ-0002eB-Kj for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:04:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPcBU-0002Z9-M8 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:04:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPcBU-0002Ya-Ed for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:04:08 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF2623E2AD for ; Tue, 19 Jul 2016 21:04:07 +0000 (UTC) References: <20160719085432.4572-1-marcandre.lureau@redhat.com> <20160719085432.4572-12-marcandre.lureau@redhat.com> From: Eric Blake Message-ID: <578E95C7.3000808@redhat.com> Date: Tue, 19 Jul 2016 15:04:07 -0600 MIME-Version: 1.0 In-Reply-To: <20160719085432.4572-12-marcandre.lureau@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XMpPPWu5qXmcT1T5pQRt3Ll9SeC5Krp6q" Subject: Re: [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XMpPPWu5qXmcT1T5pQRt3Ll9SeC5Krp6q From: Eric Blake To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Message-ID: <578E95C7.3000808@redhat.com> Subject: Re: [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command References: <20160719085432.4572-1-marcandre.lureau@redhat.com> <20160719085432.4572-12-marcandre.lureau@redhat.com> In-Reply-To: <20160719085432.4572-12-marcandre.lureau@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/19/2016 02:54 AM, marcandre.lureau@redhat.com wrote: > From: Marc-Andr=C3=A9 Lureau >=20 > srcfifo && dstfifo must still be freed in this case. >=20 > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > tests/test-io-channel-command.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-co= mmand.c > index 1d1f461..95be370 100644 > --- a/tests/test-io-channel-command.c > +++ b/tests/test-io-channel-command.c > @@ -40,7 +40,7 @@ static void test_io_channel_command_fifo(bool async) > =20 > unlink(TEST_FIFO); > if (access("/bin/socat", X_OK) < 0) { > - return; /* Pretend success if socat is not present */ > + goto end; /* Pretend success if socat is not present */ > } If we fail here... > if (mkfifo(TEST_FIFO, 0600) < 0) { =2E..then we don't create a fifo here... > abort(); > @@ -59,6 +59,7 @@ static void test_io_channel_command_fifo(bool async) > object_unref(OBJECT(src)); > object_unref(OBJECT(dst)); > =20 > +end: > g_free(srcfifo); > g_free(dstfifo); > unlink(TEST_FIFO); =2E..and unlink() will (hopefully) fail to unlink a missing file. But in= the worst case, it unlinks someone else's file. Probably worth being a bit stricter about only undoing what you have already done. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XMpPPWu5qXmcT1T5pQRt3Ll9SeC5Krp6q 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/ iQEcBAEBCAAGBQJXjpXHAAoJEKeha0olJ0NqI1gIAIT4wARmHva6XCQ2a8LwDXxs S0NrDgW3pBdD3WNpsmocKQNSLJbxUtUyESdGjgi2AD84gOLlUpo8zyAn9YdUZF0S j7QEq16yC/eE5veP0QgF1+FRBnZPDJ8fIK8JcoEdMs+VuaA3X4XYRaSNL818o6zU M4XY1GcVHvOokdk+UZ7x0Wns0MLsj2BQMT6G6rIDIGTh0yvlU4b00d6X3I+wK80G t/u50ksh8iN4Ep3OCtzp31v8YFSUAoKOao4jIPXm+OrvlXjmR5oxSiIXsr6MjIHt oSLkl+ob297V0Dk3MlGXfFX35LoYR6aTkzCCNKGI1eCzm1Cc9OP3vddDDuK7G3Q= =Y2EB -----END PGP SIGNATURE----- --XMpPPWu5qXmcT1T5pQRt3Ll9SeC5Krp6q--