From nobody Sat May 4 02:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576658248; cv=none; d=zohomail.com; s=zohoarc; b=ZMIjI/TaLzt4dF7GVHmcc1izIjzbtVckwhPs18QDwSc0AaaGamRP+ue4I/es9kXnFKLl59dv3lMAfyN1Y0BtM9YRgzTa3aO9iUY+MSwbMGHB5o9bYAsZZx7e7F3k3Zd2hoow3BPOdjLXDi8MjQZPLNsWv9zGTymMjmzfhHfjpmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576658248; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=L6C5680zti1ZebSzjJ6fbu/uRPaUcoC1swMGcoENHUE=; b=VOuH98d15WdKnlZ2um2k/I4uq5P1jJt+s75z4CIltJ4Ew3sxenHHPrxsTZfUjR3hz6g7UjQySx/MkaF4OoQr3s32DocOsCwwnuf6Y1rlS6ZnLzb5FRXvqoI5nV5dD4eelJCZXXfTfxSlx7mJrHxJMknBPgOFGhVYvPmWUCFLB3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1576658248480619.5373298177369; Wed, 18 Dec 2019 00:37:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-KyA3iXPZMIG3idGzaBNsdQ-1; Wed, 18 Dec 2019 03:37:25 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC156DBED; Wed, 18 Dec 2019 08:37:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9181360C18; Wed, 18 Dec 2019 08:37:20 +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 9C0B51854F; Wed, 18 Dec 2019 08:37:17 +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 xBI8bENM026754 for ; Wed, 18 Dec 2019 03:37:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 35AC660C81; Wed, 18 Dec 2019 08:37:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-155.brq.redhat.com [10.40.204.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7E3C60C18 for ; Wed, 18 Dec 2019 08:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576658247; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=L6C5680zti1ZebSzjJ6fbu/uRPaUcoC1swMGcoENHUE=; b=amUoMef9gfanJqXUbSd568NNPC0PxpALn82/1QGcMf2yQtCX1aka+aEjsJbmoA6YM3EBo/ 9KhInZpdIMaNdPZLQIEn+ubyfJmmgs+x2Niww+zgKGaazKzf5NRjTSxwEpLe086oVGNaNs +cfRVBU2yxcsDgI8n9lsZmZuQtu1EBU= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 09:37:04 +0100 Message-Id: <449adb462a398020b9143fcc6ec960b90783ea9b.1576658185.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] domaincapstest: Don't leak cpu definitions 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: KyA3iXPZMIG3idGzaBNsdQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When generating domain capabilities, we need to fake host CPU to get reproducible result. We do this by copying a pre-existent CPU config and setting VIR_TEST_MOCK_FAKE_HOST_CPU env variable which is then consumed by qemucpumock. However, we forget to free the CPU copy afterwards. 2,196 (2,016 direct, 180 indirect) bytes in 18 blocks are definitely lost = in loss record 291 of 297 at 0x4838B86: calloc (vg_replace_malloc.c:762) by 0x57CB6A0: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6000.7) by 0x4A0F72D: virCPUDefNew (cpu_conf.c:87) by 0x4A0FAC7: virCPUDefCopyWithoutModel (cpu_conf.c:235) by 0x4A0FBBE: virCPUDefCopy (cpu_conf.c:273) by 0x10E3C0: testUtilsHostCpusGetDefForArch (testutilshostcpus.h:157) by 0x10E3C0: fakeHostCPU (domaincapstest.c:61) by 0x10E3C0: fillQemuCaps (domaincapstest.c:86) by 0x10E3C0: test_virDomainCapsFormat (domaincapstest.c:234) by 0x10F4BC: virTestRun (testutils.c:146) by 0x10DE93: doTestQemuInternal (domaincapstest.c:301) by 0x10E13D: doTestQemu (domaincapstest.c:332) by 0x1124CF: testQemuCapsIterate (testutilsqemu.c:635) by 0x10DCE3: mymain (domaincapstest.c:435) by 0x10FD8B: virTestMain (testutils.c:916) Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- tests/domaincapstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index a4a443b1d6..9f5eab3230 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -56,7 +56,7 @@ fillStringValues(virDomainCapsStringValuesPtr values, ...) static int fakeHostCPU(virArch arch) { - virCPUDefPtr cpu; + g_autoptr(virCPUDef) cpu =3D NULL; =20 if (!(cpu =3D testUtilsHostCpusGetDefForArch(arch))) { virReportError(VIR_ERR_INTERNAL_ERROR, --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 02:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576658248; cv=none; d=zohomail.com; s=zohoarc; b=WTcg0aQ/NhybHYEN7WNzFc071EljqtkqTRY1Cx/ddx5mXxT0d2kMwg/bmOVNnSVHd9ukWtoLlYh/ncF069rNCDfgkz9Bvpj7CSgO8oIoHBGG5ae6ADlH8Qbw4b6qc80XaOuNNVm4m+nCwQYPIH5t5Rg19rqUNZx77KHZ3GgHPgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576658248; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gZAZphkkY2EAZWbD3UpBrtANfsgaYVKo3F9POyglzeE=; b=mu9cjgQfTIt7J42ZXnX3yeLG3OsMoE8jEqj+dM5tGrv8dwi53RFwTOXKZh4NirysyCYnLkhosjyd1Yx7ZdxNjHHJ9JSxhAlmkuuKroBKuhChzoSIISKwUbjJGKr2QPSJMkVlTNvqqcHE6hWgdkiN6km2fWiuyEIlEzupIPbnuIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1576658248523723.148010632174; Wed, 18 Dec 2019 00:37:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-xnDj7vtKMle0rK4Ue1-TKA-1; Wed, 18 Dec 2019 03:37:25 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64E55800D4C; Wed, 18 Dec 2019 08:37:20 +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 093C1381; Wed, 18 Dec 2019 08:37:20 +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 9C14B18089CD; Wed, 18 Dec 2019 08:37:17 +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 xBI8bF4f026762 for ; Wed, 18 Dec 2019 03:37:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1371260C81; Wed, 18 Dec 2019 08:37:15 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-155.brq.redhat.com [10.40.204.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88C7D60C18 for ; Wed, 18 Dec 2019 08:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576658247; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gZAZphkkY2EAZWbD3UpBrtANfsgaYVKo3F9POyglzeE=; b=WvCkNN79x8jkoHP0khaOQWqw+7jFbyCJ2wfnXrkRxrGAvyFEnoj+duFOkcahxwhekxMtiZ un8uSXaXu4fHeEsH86AxF3xBmVbNQjgMO95aNmRpmFWvkPU6fM3/4CF28nIWAUGNRKbr38 WyuF/A0uzweual0qXHpSrN4b+sdWDqo= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 09:37:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] testutilsxen: Avoid double free of driver caps 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: xnDj7vtKMle0rK4Ue1-TKA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In testXLInitDriver() a dummy driver structure is filled and it is freed later in testXLFreeDriver(). However, it is sufficient to unref just driver->config because that results in libxlDriverConfigDispose() being called which unrefs driver->config->caps. There is no need to unref it again in testXLFreeDriver() - in fact it's undesired. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- tests/testutilsxen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index 75cd42ec43..b73c79581d 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -105,7 +105,6 @@ libxlDriverPrivatePtr testXLInitDriver(void) =20 void testXLFreeDriver(libxlDriverPrivatePtr driver) { - virObjectUnref(driver->config->caps); virObjectUnref(driver->config); virObjectUnref(driver->xmlopt); virMutexDestroy(&driver->lock); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 02:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576658262; cv=none; d=zohomail.com; s=zohoarc; b=mUG7gaYGRGKS285d13NQThU2exmgx/I73bomrxJubBBq7vY4B52tWB5yg7Pq9nXG1C7OMPcUvQ1+3p/+XkKnzwoXe/G/IUwT2OmoVnKhvEdyyNoeBohuIEXBB27iRVyukYNxz7RXbOZJlU2cIe0eAaL/1i55rHYb9Fdex+ssdGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576658262; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yO32G3NXME1RWL8VZijTi9oKetAYA5qwGtfIvm0IH0c=; b=h+oxCTwNsMCjEgqh4reOYEk9acwNIitxZ6Si9aS0n1dzmYcebX55O+8j+pZD4VbHdIjJIbdw7L49Y43Rx4tZQeF1PAWqc5TLBTyMSxJz/RJcpKp/194gNpyK8mABxH+3zg7HPAOqRiJZoMWxQElCPeOlaVvneW8qqYwt2tckbDg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1576658262985154.72895812084573; Wed, 18 Dec 2019 00:37:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-i2p8FlqKOASy0030nxIlIA-1; Wed, 18 Dec 2019 03:37:40 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 27B7C100550E; Wed, 18 Dec 2019 08:37:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00BE05D9E5; Wed, 18 Dec 2019 08:37:35 +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 B1126827D0; Wed, 18 Dec 2019 08:37:34 +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 xBI8bFuf026772 for ; Wed, 18 Dec 2019 03:37:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id E478660C81; Wed, 18 Dec 2019 08:37:15 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-155.brq.redhat.com [10.40.204.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6500B60C18 for ; Wed, 18 Dec 2019 08:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576658261; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yO32G3NXME1RWL8VZijTi9oKetAYA5qwGtfIvm0IH0c=; b=g2kMNXC8VA3WtqZH1qsUga19GicmsCb6jj1NMk9mIpUSojUaxiswNhwm5bQgE2FWPq7AMV z2EaoKQMFa0c748f4boHjRJIuIG3jhqlz5LutqM08MEFsYIy+wv5hCch0cq05siNlPynEB nJNZ5FWvNfG29oEVOFcPYOnJF2mNwy0= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 09:37:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] virCapabilitiesHostNUMAUnref: Accept NULL 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: i2p8FlqKOASy0030nxIlIA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Fortunately, this is not causing any problems now because glib does this check for us when calling this function via attribute cleanup. But in future commit we will explicitly call this function over a struct member that might be NULL. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/conf/capabilities.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 4fac59e6f7..a782d92956 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -184,6 +184,9 @@ virCapabilitiesFreeStoragePool(virCapsStoragePoolPtr po= ol) void virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps) { + if (!caps) + return; + if (g_atomic_int_dec_and_test(&caps->refs)) { g_ptr_array_unref(caps->cells); =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 02:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576658283; cv=none; d=zohomail.com; s=zohoarc; b=EeqrA29Vx0VCNXFltcpJeJFHw7PKwZCBugycIqMetOwJq/1DUAv39d8WziNl7FmKsPqsBoQ2A2AoFjI04vqFsXWRV8JPpCxApGEBwYQ5s9ps6ObhTM4izOv0W2QnAnXjyEyWvMi3inqRcSa2TFPcItuNTB66S3YXL0fUveAHEZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576658283; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5qHUhEu9ngzuuMVAEfwTqfPi8IF8m5UzzhxM3q1oKMQ=; b=RN1UF8Vn6yySN6J5UyzpTf+Oy8Uasmjzeid4dRG3XisAkhIeRtmkMMAox2Browsn2uSSRLAOV+M42+Odh1/NsOxpzaYP9rmMudPdlKygQ82d+hXNGVJAhU2W2F4/y0YAVdN03d8WO1c/2FNgM2i68u6IlX57pgaQHz5ih03fesI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 157665828322927.27206093275288; Wed, 18 Dec 2019 00:38:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-S9iEERsXONqHcRdIbmIUYQ-1; Wed, 18 Dec 2019 03:37:39 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CC6B107ACCA; Wed, 18 Dec 2019 08:37:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68C70381; Wed, 18 Dec 2019 08:37:34 +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 21D2F827D0; Wed, 18 Dec 2019 08:37:34 +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 xBI8bGvi026779 for ; Wed, 18 Dec 2019 03:37:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id C09E660C81; Wed, 18 Dec 2019 08:37:16 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-155.brq.redhat.com [10.40.204.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 422E260C18 for ; Wed, 18 Dec 2019 08:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576658282; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5qHUhEu9ngzuuMVAEfwTqfPi8IF8m5UzzhxM3q1oKMQ=; b=HYB06KW8yyTyX7FeMiy7c6kajk3jECZlbw5tKIsckXM9pyAWHJysO4HVyPknhZ02O4xp85 wS8xUI9lUCRTStOtxfbCaa/ECv8t4YVbzW6IEe4x6UYPbNzzENYzhf/ZEfFeFjUWPR46QB yXYh6IObkFYsLiO+9RPRTN4U3bGfeDg= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 09:37:07 +0100 Message-Id: <5a2cf0792bf74ccf794dc33b1673359e3d0efbf3.1576658185.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] qemu: Reoder cleanup in qemuStateCleanup() 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: S9iEERsXONqHcRdIbmIUYQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function is supposed to clean up virQEMUDriver structure and free individual members. However, it's doing that in random order which makes it hard to track which members are being freed and which are not. Do the free in reverse order than the structure definition - assuming that the most important members (like mutex) are declared first and freed last. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 43 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 65c3be58d3..0b9e31b344 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1122,38 +1122,29 @@ qemuStateCleanup(void) if (!qemu_driver) return -1; =20 - if (qemu_driver->lockFD !=3D -1) - virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_dr= iver->lockFD); - virThreadPoolFree(qemu_driver->workerPool); - virObjectUnref(qemu_driver->config); - virObjectUnref(qemu_driver->hostdevMgr); - virHashFree(qemu_driver->sharedDevices); - virObjectUnref(qemu_driver->caps); - virObjectUnref(qemu_driver->qemuCapsCache); - - virObjectUnref(qemu_driver->domains); - virPortAllocatorRangeFree(qemu_driver->remotePorts); - virPortAllocatorRangeFree(qemu_driver->webSocketPorts); - virPortAllocatorRangeFree(qemu_driver->migrationPorts); virObjectUnref(qemu_driver->migrationErrors); - - virObjectUnref(qemu_driver->xmlopt); - - virSysinfoDefFree(qemu_driver->hostsysinfo); - virObjectUnref(qemu_driver->closeCallbacks); - - VIR_FREE(qemu_driver->qemuImgBinary); - + virLockManagerPluginUnref(qemu_driver->lockManager); + virSysinfoDefFree(qemu_driver->hostsysinfo); + virPortAllocatorRangeFree(qemu_driver->migrationPorts); + virPortAllocatorRangeFree(qemu_driver->webSocketPorts); + virPortAllocatorRangeFree(qemu_driver->remotePorts); + virHashFree(qemu_driver->sharedDevices); + virObjectUnref(qemu_driver->hostdevMgr); virObjectUnref(qemu_driver->securityManager); - - ebtablesContextFree(qemu_driver->ebtables); - - /* Free domain callback list */ virObjectUnref(qemu_driver->domainEventState); + virObjectUnref(qemu_driver->qemuCapsCache); + virObjectUnref(qemu_driver->xmlopt); + virObjectUnref(qemu_driver->caps); + ebtablesContextFree(qemu_driver->ebtables); + VIR_FREE(qemu_driver->qemuImgBinary); + virObjectUnref(qemu_driver->domains); + virThreadPoolFree(qemu_driver->workerPool); =20 - virLockManagerPluginUnref(qemu_driver->lockManager); + if (qemu_driver->lockFD !=3D -1) + virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_dr= iver->lockFD); =20 + virObjectUnref(qemu_driver->config); virMutexDestroy(&qemu_driver->lock); VIR_FREE(qemu_driver); =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 02:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576658267; cv=none; d=zohomail.com; s=zohoarc; b=aSKl4TRyfO48ITAJUZxGKnOk+jhtgPcNqg/us70f8txW/Wos1dMmOkBj/T4EfyCqP4zi92Euw19BjyxaGI0n3HdiR1cd7+wzfPB8dK2tduAMXfY8DI3JK+5/GnYtzFTIFMjNXD3MYpPF1Fcq+R8Fdh/+5LjOxlh8i+qIw2cY2Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576658267; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nRdpiXBg5iP+ulUnkXDj5Mx5MbJ9XoGpZaj2szrLUb4=; b=Y5nsfa0aBZR6biPUG9Nlqc3OU/L6kHKHk2Uq6Y04MQ4TATpJXp8mk2l1E9vnVN4Er2c17KIs1rm2r18/MHl2SJ+WYNQQQHV4AVHoXY4ACdCqkbAf/9BZBJhE7fWTpgnzvSvD2bsroxjHmjX7hkcEn77zpBuLrDrFxUvI0yqHxJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576658267887996.4497952067469; Wed, 18 Dec 2019 00:37:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-81-WIxyIZ0EN9iQ9qOzRCdSyg-1; Wed, 18 Dec 2019 03:37:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20E36DBED; Wed, 18 Dec 2019 08:37:38 +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 EC5A060C81; Wed, 18 Dec 2019 08:37:37 +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 A717118089CF; Wed, 18 Dec 2019 08:37:37 +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 xBI8bJfO026798 for ; Wed, 18 Dec 2019 03:37:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 490EC60C81; Wed, 18 Dec 2019 08:37:19 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-155.brq.redhat.com [10.40.204.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE14E60C18 for ; Wed, 18 Dec 2019 08:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576658265; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nRdpiXBg5iP+ulUnkXDj5Mx5MbJ9XoGpZaj2szrLUb4=; b=Q2CHCAjszCq2fjfOMonSeO7WcBRGV9p5pYlasXGWpgxEoYUxOvUhoN9SLXC86P3fe5j6Jm QPDjsM4xylNv9pEKC8eGhwGU8zaKq0RlguEF5UTFyDjrdWVrEGdPnNTpdQLFQ00WQs3iug 3a1LZQ8XrrPbvSUzpMhskUlBoJ1ja2s= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 09:37:08 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] qemu: Don't leak hostcpu or hostnuma on driver cleanup 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: WIxyIZ0EN9iQ9qOzRCdSyg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When freeing qemu driver struct members, we forgot to free @hostcpu and @hostnuma members. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0b9e31b344..ec8faf384c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1135,6 +1135,8 @@ qemuStateCleanup(void) virObjectUnref(qemu_driver->domainEventState); virObjectUnref(qemu_driver->qemuCapsCache); virObjectUnref(qemu_driver->xmlopt); + virCPUDefFree(qemu_driver->hostcpu); + virCapabilitiesHostNUMAUnref(qemu_driver->hostnuma); virObjectUnref(qemu_driver->caps); ebtablesContextFree(qemu_driver->ebtables); VIR_FREE(qemu_driver->qemuImgBinary); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list