From nobody Mon Mar 30 00:48:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 149181085991790.56427904725763; Mon, 10 Apr 2017 00:54:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9882583F45; Mon, 10 Apr 2017 07:54:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FA0E86180; Mon, 10 Apr 2017 07:54:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1FECC4EBDE; Mon, 10 Apr 2017 07:54:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3A7s7Hw027156 for ; Mon, 10 Apr 2017 03:54:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E656A3A65; Mon, 10 Apr 2017 07:54:07 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-230.brq.redhat.com [10.34.129.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9725178C06 for ; Mon, 10 Apr 2017 07:54:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9882583F45 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9882583F45 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 10 Apr 2017 09:54:00 +0200 Message-Id: <49393dc88c0a049e83f27ff51071642f86cc573c.1491810803.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] tests: fix some resource leaks X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Apr 2017 07:54:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Found by running valgrind for these tests. Signed-off-by: Pavel Hrdina --- tests/commandtest.c | 3 +++ tests/domaincapstest.c | 2 ++ tests/fchosttest.c | 2 ++ tests/vircgroupmock.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/tests/commandtest.c b/tests/commandtest.c index 80f10f88fc..1f6f16bcde 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -1093,6 +1093,9 @@ static int test25(const void *unused ATTRIBUTE_UNUSED) virCommandPtr cmd =3D virCommandNew("some/nonexistent/binary"); =20 rv =3D virCommandExec(cmd); + + virCommandFree(cmd); + if (safewrite(pipeFD[1], &rv, sizeof(rv)) < 0) fprintf(stderr, "Unable to write to pipe\n"); _exit(EXIT_FAILURE); diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index f871197c25..b76332ce94 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -563,6 +563,8 @@ mymain(void) DO_TEST_BHYVE("fbuf", "/usr/sbin/bhyve", &bhyve_caps, VIR_DOMAIN_VIRT_= BHYVE); #endif /* WITH_BHYVE */ =20 + virObjectUnref(cfg); + return ret; } =20 diff --git a/tests/fchosttest.c b/tests/fchosttest.c index ac4e92910d..3ee1912926 100644 --- a/tests/fchosttest.c +++ b/tests/fchosttest.c @@ -315,6 +315,7 @@ manageVHBAByStoragePool(const void *data) ignore_value(virStoragePoolDestroy(pool)); goto cleanup; } + virNodeDeviceFree(dev); =20 if (virStoragePoolDestroy(pool) < 0) goto cleanup; @@ -322,6 +323,7 @@ manageVHBAByStoragePool(const void *data) if ((dev =3D virNodeDeviceLookupByName(conn, expect_hostname))) { VIR_DEBUG("Found expected_hostname '%s' after destroy", expect_hostname); + virNodeDeviceFree(dev); goto cleanup; } =20 diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index ce6fd46266..9eb989ad7e 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -429,8 +429,10 @@ static void init_sysfs(void) abort(); \ if (make_controller(path, 0755) < 0) { \ fprintf(stderr, "Cannot initialize %s\n", path); \ + free(path); \ abort(); \ } \ + free(path); \ } while (0) =20 MAKE_CONTROLLER("cpu"); --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list