From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477846234887.8998631800325; Fri, 8 Jun 2018 10:10:46 -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 803E1C04AC50; Fri, 8 Jun 2018 17:10:44 +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 48EFD68873; Fri, 8 Jun 2018 17:10:44 +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 EDC064CA81; Fri, 8 Jun 2018 17:10:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAOOn019651 for ; Fri, 8 Jun 2018 13:10:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 226572010CA1; Fri, 8 Jun 2018 17:10:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id D49292010CA0 for ; Fri, 8 Jun 2018 17:10:23 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:14 -0400 Message-Id: <20180608171019.32167-2-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] vbox: 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.31]); Fri, 08 Jun 2018 17:10:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Need to free the allocated hardDiskToOpen array. The contents of the array are just pointers returned by virVBoxSnapshotConfHardDiskByLocation and not allocated AFAICT so they don't need to also be freed as well. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- src/vbox/vbox_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 72a24a3464..0e7fe06748 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -4627,6 +4627,8 @@ vboxSnapshotRedefine(virDomainPtr dom, int realReadOnlyDisksPathSize =3D 0; virVBoxSnapshotConfSnapshotPtr newSnapshotPtr =3D NULL; unsigned char snapshotUuid[VIR_UUID_BUFLEN]; + virVBoxSnapshotConfHardDiskPtr *hardDiskToOpen =3D NULL; + size_t hardDiskToOpenSize =3D 0; char **searchResultTab =3D NULL; ssize_t resultSize =3D 0; int it =3D 0; @@ -5080,8 +5082,6 @@ vboxSnapshotRedefine(virDomainPtr dom, */ for (it =3D 0; it < def->dom->ndisks; it++) { char *location =3D NULL; - virVBoxSnapshotConfHardDiskPtr *hardDiskToOpen =3D NULL; - size_t hardDiskToOpenSize =3D 0; =20 location =3D def->dom->disks[it]->src->path; if (!location) @@ -5394,8 +5394,7 @@ vboxSnapshotRedefine(virDomainPtr dom, if (!location) goto cleanup; =20 - virVBoxSnapshotConfHardDiskPtr *hardDiskToOpen =3D NULL; - size_t hardDiskToOpenSize =3D virVBoxSnapshotConfDiskListToOpen(sn= apshotMachineDesc, + hardDiskToOpenSize =3D virVBoxSnapshotConfDiskListToOpen(snapshotM= achineDesc, &hardDiskToOpen, locati= on); for (jt =3D 0; jt < hardDiskToOpenSize; jt++) { IMedium *medium =3D NULL; @@ -5459,6 +5458,7 @@ vboxSnapshotRedefine(virDomainPtr dom, virStringListFree(realReadOnlyDisksPath); virStringListFree(realReadWriteDisksPath); virStringListFree(searchResultTab); + VIR_FREE(hardDiskToOpen); VIR_FREE(newSnapshotPtr); VIR_FREE(machineLocationPath); VIR_FREE(nameTmpUse); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477833969720.2919437976053; Fri, 8 Jun 2018 10:10:33 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 5F133804F3; Fri, 8 Jun 2018 17:10:30 +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 004D55D9C7; Fri, 8 Jun 2018 17:10:28 +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 BD0E51800FC1; Fri, 8 Jun 2018 17:10:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAOYE019657 for ; Fri, 8 Jun 2018 13:10:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 82A452010D0E; Fri, 8 Jun 2018 17:10:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45B532010CA0 for ; Fri, 8 Jun 2018 17:10:24 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:15 -0400 Message-Id: <20180608171019.32167-3-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] vbox: 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 08 Jun 2018 17:10:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The @disk was allocated, filled in, and consumed on the normal path, but for error/cleanup paths it would be leaked. Rename to newHardDisk and manage properly. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- src/vbox/vbox_common.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 0e7fe06748..664650f217 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -4629,6 +4629,7 @@ vboxSnapshotRedefine(virDomainPtr dom, unsigned char snapshotUuid[VIR_UUID_BUFLEN]; virVBoxSnapshotConfHardDiskPtr *hardDiskToOpen =3D NULL; size_t hardDiskToOpenSize =3D 0; + virVBoxSnapshotConfHardDiskPtr newHardDisk =3D NULL; char **searchResultTab =3D NULL; ssize_t resultSize =3D 0; int it =3D 0; @@ -5236,7 +5237,6 @@ vboxSnapshotRedefine(virDomainPtr dom, PRUnichar *newLocation =3D NULL; char *newLocationUtf8 =3D NULL; resultCodeUnion resultCode; - virVBoxSnapshotConfHardDiskPtr disk =3D NULL; char *uuid =3D NULL; char *format =3D NULL; char *tmp =3D NULL; @@ -5301,11 +5301,11 @@ vboxSnapshotRedefine(virDomainPtr dom, } VBOX_RELEASE(progress); /* - * The differential disk is created, we add it to the media re= gistry and the - * machine storage controllers. + * The differential newHardDisk is created, we add it to the + * media registry and the machine storage controllers. */ =20 - if (VIR_ALLOC(disk) < 0) + if (VIR_ALLOC(newHardDisk) < 0) goto cleanup; =20 rc =3D gVBoxAPI.UIMedium.GetId(newMedium, &iid); @@ -5316,24 +5316,25 @@ vboxSnapshotRedefine(virDomainPtr dom, goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid); - disk->uuid =3D uuid; + newHardDisk->uuid =3D uuid; vboxIIDUnalloc(&iid); =20 - if (VIR_STRDUP(disk->location, newLocationUtf8) < 0) + if (VIR_STRDUP(newHardDisk->location, newLocationUtf8) < 0) goto cleanup; =20 rc =3D gVBoxAPI.UIMedium.GetFormat(newMedium, &formatUtf16); VBOX_UTF16_TO_UTF8(formatUtf16, &format); - disk->format =3D format; + newHardDisk->format =3D format; VBOX_UTF16_FREE(formatUtf16); =20 - if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(disk, + if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(newHardDisk, snapshotMachineDesc->mediaRegis= try, parentUuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to add hard disk to the media reg= istry")); goto cleanup; } + newHardDisk =3D NULL; /* Consumed by above */ /*Adding the fake disk to the machine storage controllers*/ =20 resultSize =3D virStringSearch(snapshotMachineDesc->storageCon= troller, @@ -5348,7 +5349,7 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 tmp =3D virStringReplace(snapshotMachineDesc->storageControlle= r, searchResultTab[it], - disk->uuid); + uuid); VIR_FREE(snapshotMachineDesc->storageController); if (!tmp) goto cleanup; @@ -5458,6 +5459,7 @@ vboxSnapshotRedefine(virDomainPtr dom, virStringListFree(realReadOnlyDisksPath); virStringListFree(realReadWriteDisksPath); virStringListFree(searchResultTab); + virVboxSnapshotConfHardDiskFree(newHardDisk); VIR_FREE(hardDiskToOpen); VIR_FREE(newSnapshotPtr); VIR_FREE(machineLocationPath); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477851851433.4051237113248; Fri, 8 Jun 2018 10:10:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A64B30C10E8; Fri, 8 Jun 2018 17:10:50 +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 5109F308BDA9; Fri, 8 Jun 2018 17:10:50 +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 DC4AB1800FED; Fri, 8 Jun 2018 17:10:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAOxI019661 for ; Fri, 8 Jun 2018 13:10:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id E85F62010D0E; Fri, 8 Jun 2018 17:10:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB4232010D0D for ; Fri, 8 Jun 2018 17:10:24 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:16 -0400 Message-Id: <20180608171019.32167-4-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] qemu: Fix Coverity build for qemu_monitor 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 08 Jun 2018 17:10:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit id '7ef0471bf' added a new parameter to qemuMonitorOpen, but didn't update the ATTTRIBUTE_NONNULL for the @cb (param 5). Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- src/qemu/qemu_monitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 43843721bf..d01266ff86 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -317,7 +317,7 @@ qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm, unsigned long long timeout, qemuMonitorCallbacksPtr cb, void *opaque) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5); + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6); qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm, int sockfd, bool json, --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477832339359.9624883268616; Fri, 8 Jun 2018 10:10:32 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A54674E4F3; Fri, 8 Jun 2018 17:10:30 +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 728C633EA2; Fri, 8 Jun 2018 17:10:30 +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 C72081800FD9; Fri, 8 Jun 2018 17:10:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAPnn019671 for ; Fri, 8 Jun 2018 13:10:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 598E92010CA0; Fri, 8 Jun 2018 17:10:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BC912010D0D for ; Fri, 8 Jun 2018 17:10:25 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:17 -0400 Message-Id: <20180608171019.32167-5-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] test: Fix resource leak in qemumonitorjsontest 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 08 Jun 2018 17:10:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduced by commmit id 37bd4571c. Need to goto cleanup and not return directly. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- tests/qemumonitorjsontest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 3b494a1dba..2eefd06b6e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2693,7 +2693,7 @@ testQemuMonitorCPUInfo(const void *opaque) =20 vm =3D qemuMonitorTestGetDomainObj(test); if (!vm) - return -1; + goto cleanup; =20 rc =3D qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test), &vcpus, data->maxvcpus, true, data->fast); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477859435607.0782193812677; Fri, 8 Jun 2018 10:10:59 -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 75E1181DE1; Fri, 8 Jun 2018 17:10:58 +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 3D90460BB3; Fri, 8 Jun 2018 17:10:58 +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 DDEBB4CA87; Fri, 8 Jun 2018 17:10:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAPvp019676 for ; Fri, 8 Jun 2018 13:10:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id BDEB52010CA1; Fri, 8 Jun 2018 17:10:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8013C2010CA0 for ; Fri, 8 Jun 2018 17:10:25 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:18 -0400 Message-Id: <20180608171019.32167-6-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] test: Check return status for libxlxml2domconfigtest 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.25]); Fri, 08 Jun 2018 17:10:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit id d8e8b63d introduced the test, but neglected to check for error from virTestLoadFile in testCompareXMLToDomConfig. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- tests/libxlxml2domconfigtest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 0d2a7385e5..54a92cc959 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -104,7 +104,9 @@ testCompareXMLToDomConfig(const char *xmlfile, goto cleanup; } =20 - virTestLoadFile(jsonfile, &tempjson); + if (virTestLoadFile(jsonfile, &tempjson) < 0) + goto cleanup; + if (libxl_domain_config_from_json(cfg->ctx, &expectconfig, tempjson) != =3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Failed to create libxl_domain_config from JSON doc= "); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 02:01:59 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528477845008241.8503065796624; Fri, 8 Jun 2018 10:10:45 -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 CF420804E4; Fri, 8 Jun 2018 17:10:43 +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 8E85460BB3; Fri, 8 Jun 2018 17:10:43 +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 3C6D14CA81; Fri, 8 Jun 2018 17:10:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w58HAQMw019684 for ; Fri, 8 Jun 2018 13:10:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 318C72010CA1; Fri, 8 Jun 2018 17:10:26 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-102.phx2.redhat.com [10.3.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id E42632010CA0 for ; Fri, 8 Jun 2018 17:10:25 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 13:10:19 -0400 Message-Id: <20180608171019.32167-7-jferlan@redhat.com> In-Reply-To: <20180608171019.32167-1-jferlan@redhat.com> References: <20180608171019.32167-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] conf: Check error from virXMLFormatElement call 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.27]); Fri, 08 Jun 2018 17:10:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit id 1bd5a08d added a call to virXMLFormatElement without also checking the return status. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Katerina Koukiou --- src/conf/domain_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ab93bb7b45..1157c7dd93 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27522,7 +27522,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, unit, short_size); } =20 - virXMLFormatElement(buf, "smm", &attrBuf, &childBuf); + if (virXMLFormatElement(buf, "smm", &attrBuf, &childBu= f) < 0) + goto error; } =20 break; --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list