From nobody Sun Apr 28 20:43:31 2024 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 1491810849122964.6766582464521; Mon, 10 Apr 2017 00:54:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1D273D952; Mon, 10 Apr 2017 07:54:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FD4D18ACB; Mon, 10 Apr 2017 07:54:07 +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 574FF4EBDC; Mon, 10 Apr 2017 07:54:07 +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 v3A7s412027135 for ; Mon, 10 Apr 2017 03:54:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E56EA3A65; Mon, 10 Apr 2017 07:54:04 +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 B74C878C06 for ; Mon, 10 Apr 2017 07:54:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D1D273D952 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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 D1D273D952 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 10 Apr 2017 09:53:57 +0200 Message-Id: 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 1/4] conf/domain_capabilities: fix resource leak 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 10 Apr 2017 07:54:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 14319c81a0 introduced CPU host model in domain capabilities and the *hostmodel* variable is always filled by virCPUDefCopy() and needs to be freed. Signed-off-by: Pavel Hrdina --- src/conf/domain_capabilities.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 7a3d2e6fb1..7a81c10fd1 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -82,6 +82,7 @@ virDomainCapsDispose(void *obj) VIR_FREE(caps->path); VIR_FREE(caps->machine); virObjectUnref(caps->cpu.custom); + virCPUDefFree(caps->cpu.hostModel); =20 virDomainCapsStringValuesFree(&caps->os.loader.values); } --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 20:43:31 2024 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 1491810853296193.82799568851; Mon, 10 Apr 2017 00:54:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E0C380463; Mon, 10 Apr 2017 07:54:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73DF199E82; Mon, 10 Apr 2017 07:54:11 +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 2920A18523C8; Mon, 10 Apr 2017 07:54:11 +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 v3A7s5uQ027143 for ; Mon, 10 Apr 2017 03:54:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 21DDDA3A65; Mon, 10 Apr 2017 07:54:05 +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 99FAE78C06 for ; Mon, 10 Apr 2017 07:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E0C380463 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.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 9E0C380463 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 10 Apr 2017 09:53:58 +0200 Message-Id: <4c63aae82aba76f81e059e5029bae836ca7d2b59.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 2/4] src: fix multiple resource leaks in loops 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 10 Apr 2017 07:54:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All of the variables are filled inside a loop and therefore needs to be also freed in every cycle. Signed-off-by: Pavel Hrdina --- src/conf/node_device_conf.c | 10 +++++----- src/conf/storage_conf.c | 1 + src/util/virsysinfo.c | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 7d0baa9d1a..e21a98d51f 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1582,7 +1582,6 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, for (i =3D 0, m =3D 0; i < n; i++) { xmlNodePtr node =3D nodes[i]; char *tmp =3D virXMLPropString(node, "type"); - virNodeDevDevnodeType type; int val; =20 if (!tmp) { @@ -1591,15 +1590,16 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, goto error; } =20 - if ((val =3D virNodeDevDevnodeTypeFromString(tmp)) < 0) { + val =3D virNodeDevDevnodeTypeFromString(tmp); + VIR_FREE(tmp); + + if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown devnode type '%s'"), tmp); - VIR_FREE(tmp); goto error; } - type =3D val; =20 - switch (type) { + switch ((virNodeDevDevnodeType)val) { case VIR_NODE_DEV_DEVNODE_DEV: def->devnode =3D (char*)xmlNodeGetContent(node); break; diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index fe0f0bcdc7..b66e67254a 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -471,6 +471,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, port); goto cleanup; } + VIR_FREE(port); } } } diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 8d3377c04e..650216d006 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -521,6 +521,8 @@ virSysinfoParseS390Processor(const char *base, virSysin= foDefPtr ret) &processor->processor_family, '=3D', '\n')) goto cleanup; + + VIR_FREE(procline); } result =3D 0; =20 --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 20:43:31 2024 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 149181085620417.93892375924611; Mon, 10 Apr 2017 00:54:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 074E09D0EB; Mon, 10 Apr 2017 07:54:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D10E18C7FA; Mon, 10 Apr 2017 07:54:14 +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 90F471FF; Mon, 10 Apr 2017 07:54:14 +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 v3A7s6uY027151 for ; Mon, 10 Apr 2017 03:54:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BAD978C06; Mon, 10 Apr 2017 07:54:06 +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 C1A30A3A65 for ; Mon, 10 Apr 2017 07:54:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 074E09D0EB Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.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 074E09D0EB From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 10 Apr 2017 09:53:59 +0200 Message-Id: <27b0916a24efd2cdb0b5f2444fe6a4e321b0c6be.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 3/4] rpc: fix resource leak 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 10 Apr 2017 07:54:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 252610f7dd1 switched to use hash to store servers. Function virHashGetItems returns allocated array which needs to be freed also for successful path, not only if there is an error. Signed-off-by: Pavel Hrdina --- src/rpc/virnetdaemon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index dcc89fa097..fabacf2039 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -401,6 +401,7 @@ virNetDaemonPreExecRestart(virNetDaemonPtr dmn) } } =20 + VIR_FREE(srvArray); virObjectUnlock(dmn); =20 return object; --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 20:43:31 2024 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