From patchwork Tue Sep 6 13:36:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9316971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0F41601C0 for ; Tue, 6 Sep 2016 13:55:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88D5228D33 for ; Tue, 6 Sep 2016 13:55:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DB5028C1D; Tue, 6 Sep 2016 13:55:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1386328A61 for ; Tue, 6 Sep 2016 13:55:42 +0000 (UTC) Received: from localhost ([::1]:33619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhGqi-0003T1-UR for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Sep 2016 09:55:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhGYR-00047I-B7 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:36:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhGYN-0008Ux-M9 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:36:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhGYN-0008Us-G4 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:36:43 -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 1D4A0B98C2 for ; Tue, 6 Sep 2016 13:36:43 +0000 (UTC) Received: from localhost (ovpn-116-72.phx2.redhat.com [10.3.116.72]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86DaeIA007488; Tue, 6 Sep 2016 09:36:42 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 6 Sep 2016 17:36:37 +0400 Message-Id: <20160906133637.32147-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 06 Sep 2016 13:36:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3] tests: fix small leak in test-io-channel-command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP srcfifo && dstfifo must still be freed if socat is not present. Only unlink if the fifo was actually created. Signed-off-by: Marc-André Lureau Signed-off-by: Daniel P. Berrange --- tests/test-io-channel-command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c index 1d1f461..4fc1732 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) 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 (mkfifo(TEST_FIFO, 0600) < 0) { abort(); @@ -59,9 +59,11 @@ static void test_io_channel_command_fifo(bool async) object_unref(OBJECT(src)); object_unref(OBJECT(dst)); + unlink(TEST_FIFO); + +end: g_free(srcfifo); g_free(dstfifo); - unlink(TEST_FIFO); }