From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPcN9-0003yb-0h for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:16:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPcN4-0006Ih-Rr for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:16:10 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:43832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPcN4-0006IS-Ja for qemu-devel@nongnu.org; Tue, 19 Jul 2016 17:16:06 -0400 Date: Tue, 19 Jul 2016 17:16:04 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <879082947.6581836.1468962964189.JavaMail.zimbra@redhat.com> In-Reply-To: <578E95C7.3000808@redhat.com> References: <20160719085432.4572-1-marcandre.lureau@redhat.com> <20160719085432.4572-12-marcandre.lureau@redhat.com> <578E95C7.3000808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Eric Blake Cc: marcandre lureau , qemu-devel@nongnu.org Hi ----- Original Message ----- > 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-command.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 */ > > } >=20 > If we fail here... >=20 > > if (mkfifo(TEST_FIFO, 0600) < 0) { >=20 > ...then we don't create a fifo here... >=20 > > 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); >=20 > ...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. But the test starts by unlinking unconditionally too, so not sure it's real= ly worth. >=20 >=20 > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >=20 >=20