From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606913052; cv=none; d=zohomail.com; s=zohoarc; b=kbFY8ciDGlUm6hdJKl6g8smh8rqMIxNsixAeGn7sukcsgTCRlb6ZdKnauJ89PYy6boZw2TZkt4i/pYW1kCOpWnQIFLlVvT6WrLcEwQfEXapPE1QQ1l32PZbRfy11d5XKNKxWCfV2FoKpdBPbu25qnunpwKopyIc8fnsxrdsiWcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913052; 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=4w9eRY5ZdT3ZaRg8xGSwuGnBTGHJhy35CBQsgAnhCMg=; b=X50SLasEBreWvTAvLkHWisnRyF/WQxFIxmY2qnUXoUeArMqDP8nHPmjDfDkxN3jvt73QxI/sy4h8GpI1dxRiseT3i0XsZQJ5JlvzcK0JgOn5+K+PXMx9Hs7aOOT8sFIG5hDTmhp9tlGnliwBmdbgdh6r+3BCrccea622m7TImCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 160691305241923.96151373742373; Wed, 2 Dec 2020 04:44:12 -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-292-vvruvsPqO3CUNtKT85gTGA-1; Wed, 02 Dec 2020 07:44:09 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4467D420F4; Wed, 2 Dec 2020 12:44:03 +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 125185D6AC; Wed, 2 Dec 2020 12:44:03 +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 CE0441809CA0; Wed, 2 Dec 2020 12:44:02 +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 0B2ChQa0003670 for ; Wed, 2 Dec 2020 07:43:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 81C7D60BFA; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43C0060C0F for ; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913051; 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=4w9eRY5ZdT3ZaRg8xGSwuGnBTGHJhy35CBQsgAnhCMg=; b=Xs9SMw8muWbD5pnMc1PM5q+rYIUQHzng4NoCqsyOme+EXqvmNJbxxcBDQ4Ln//fpBbHBQN oO+svWLua6VpVHNegHZT/sqNH6zNVpAFlfr0lS9kzJ4Ge7J7r2Uhw2Ytuu5zIS1VBFlLgk Rv5GVrYsBOb2yAMwiUN1eNu+NKlzAv8= X-MC-Unique: vvruvsPqO3CUNtKT85gTGA-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 1/7] util: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster Date: Wed, 2 Dec 2020 07:43:15 -0500 Message-Id: <20201202124321.765271-2-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since 032548c4 @cmd was never autofree'd. Perhaps as a result of VIR_AUTOPTR type changes occurring at roughly the same time so the copy pasta missed this. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/util/virnetdevopenvswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index 7452527f49..d380b0cf22 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -428,7 +428,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, int virNetDevOpenvswitchInterfaceGetMaster(const char *ifname, char **master) { - virCommandPtr cmd =3D virNetDevOpenvswitchCreateCmd(); + g_autoptr(virCommand) cmd =3D virNetDevOpenvswitchCreateCmd(); int exitstatus; =20 *master =3D NULL; --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606913053; cv=none; d=zohomail.com; s=zohoarc; b=apsnUQygURpqdQO6Bjvzv9mlmBjpp8k24glyg9IiJTITqRfLKtW9XkulEvmA25NDNIeyr5t5T6WMnjUsnlaRuSrX1WBXFvGDlnea+3M5YAGLCcNQMUwV8on3QAGXtT0HvO2LuZte0hc6UV5OEntQZTEZXWBdElCWInK6PcNfy9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913053; 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=aUCFAo54tgLDfxIu6u2/ioC8+19SjX1BZWgk8pujALk=; b=ld7QEUJOngAcNOz9zhNe5BZ4GgcdM2anHYzm8Y/be19AQ0uGPkAcA20yDOa+6NKWcUeUpXdqAHNMuV1/Oz0nr8B5osqXahar+CmPyq/ytfd3NpO+Nu27W7Bvh/An1ktccIJ18G/HgFSBeZP3gJsC8/FSaXNkzQi9nwsKKaIay9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16069130533551018.9094988571269; Wed, 2 Dec 2020 04:44:13 -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-427-NSYfN1A8NS6J56cB31m8Bw-1; Wed, 02 Dec 2020 07:44:10 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62E3C100C612; Wed, 2 Dec 2020 12:44:04 +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 3D51C5D6AC; Wed, 2 Dec 2020 12:44:04 +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 F41084E58E; Wed, 2 Dec 2020 12:44:03 +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 0B2ChQX4003675 for ; Wed, 2 Dec 2020 07:43:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id E3FCA60C0F; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6EB860BFA for ; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913052; 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=aUCFAo54tgLDfxIu6u2/ioC8+19SjX1BZWgk8pujALk=; b=XAStlQz3mV/VMogc22ZrPx+0D+S/5TVZok4HzN+VBBDPqA7VoXif0cBZD58LwqhKXw4HtR C0ha0VU/z5cTpAyjpoUXvtqmkof++L4nsocJ6iCEuVecMeOkgA58j8C4qnE2z3rGfybDqw E+2LmOpEeLA6Pxdto9pxiumlVUPSTNs= X-MC-Unique: NSYfN1A8NS6J56cB31m8Bw-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 2/7] util: Resolve resource leak in virExec error path Date: Wed, 2 Dec 2020 07:43:16 -0500 Message-Id: <20201202124321.765271-3-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" On error, the @pidfilefd was not released Found by Coverity Signed-off-by: John Ferlan --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index e47dd6b932..1716225aeb 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -792,12 +792,14 @@ virExec(virCommandPtr cmd) if (virSetInherit(pidfilefd, true) < 0) { virReportSystemError(errno, "%s", _("Cannot disable close-on-exec flag")); + virPidFileReleasePath(cmd->pidfile, pidfilefd); goto fork_error; } =20 c =3D '1'; if (safewrite(pipesync[1], &c, sizeof(c)) !=3D sizeof(c)) { virReportSystemError(errno, "%s", _("Unable to notify child pr= ocess")); + virPidFileReleasePath(cmd->pidfile, pidfilefd); goto fork_error; } VIR_FORCE_CLOSE(pipesync[0]); --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606913056; cv=none; d=zohomail.com; s=zohoarc; b=LHMP0eDZkHY/fTGoQH32IfpZyehxvzZa6F89fOLoXuGxO5ozxTvJ56zaNlrWdxCG51iNzZZqmKaB++CQAuS9jHGzV0WnFto/Bd+ivn/IJi2qiuiM4r1+9reVb1poPVv08BGK9Scop8iBKdueNekRFnmtV24HC/huiwV7hBCrD8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913056; 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=ncvOdIdjVUnPZHLSUI/ZE0ORoz28euSJ7NlEsN4Te80=; b=UQiPO2PhlDCBGasBi7ySxmumKZhwGwxvcsOdoYPkrZlYsjqO+LfuDN7LV5D6eDfDo4tooJAzW3RImGyw/FgDpqIfC1yz5vU80ry86cKEmbV5NH0fKalphK8bF9pN32I9MKHccMy7srpc2EG/EuZbdlQrVczaW6gPct2sgIGi7Qs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606913056513916.6382081503048; Wed, 2 Dec 2020 04:44:16 -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-510-P9UnV-yYNau-WHJyjS3lFw-1; Wed, 02 Dec 2020 07:44:12 -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 3A78B8144F0; Wed, 2 Dec 2020 12:44:07 +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 189445D9DC; Wed, 2 Dec 2020 12:44: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 D8A3685CC; Wed, 2 Dec 2020 12:44:06 +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 0B2ChRLs003683 for ; Wed, 2 Dec 2020 07:43:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 52A4660C0F; Wed, 2 Dec 2020 12:43:27 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15ADB60BFA for ; Wed, 2 Dec 2020 12:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913055; 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=ncvOdIdjVUnPZHLSUI/ZE0ORoz28euSJ7NlEsN4Te80=; b=bLOsJxeceXwNTwZgaaGPaa63Gv0OmD/3OgHC6iJ1mCXKFCRYcOL0cpBlAOXIVadyqH5N3P fccxjEZAyOqfW+nsqegBafJigW2C6QMlOUkbccmei0/2R7e0c2OL+QzHRgAUSnx7yWR4wz j+w3SqEj+XIDKsHp2U3wmrldmLjkAB8= X-MC-Unique: P9UnV-yYNau-WHJyjS3lFw-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 3/7] docs: Fix link for virConnectGetStoragePoolCapabilities Date: Wed, 2 Dec 2020 07:43:17 -0500 Message-Id: <20201202124321.765271-4-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The API is in the storage family not the domain family Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- docs/formatstoragecaps.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/formatstoragecaps.html.in b/docs/formatstoragecaps.html.in index 900303aef7..a9ecc371fa 100644 --- a/docs/formatstoragecaps.html.in +++ b/docs/formatstoragecaps.html.in @@ -20,7 +20,7 @@ (Since 5.2.0):

=20
-virConnectGetStoragePoolCapabilities
+virConnectGetStoragePoolCapabilities
 
=20

The root element that emulator capability XML document starts with = is --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606913029; cv=none; d=zohomail.com; s=zohoarc; b=AGsoYx0HZbEQuIJzoGhxxDVHdDLGYsgfhNzsCtUEGegiKIKLjiMVb4hViBmqCgPXR+M/78tlN/87Ks04ZPm4ijdvZ8+Nve1hT7MaGVMTgbEMXyQeNwoaUq8SOMu3D9DNuKtvgKNxQ2GVg+loEldszrmym28hPYNWAzFW6lb9oh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913029; 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=t5ryfdhTpYffyG7wvYUKJPBs5cltcDVVqLBxdD5efl4=; b=JgRrZCJnDe+kBIS2ZqTQ+TlmojBxWwsMIwsW5kBHH4PkDzs8+PsLgebvlerdkwbLFFmoc4ET2U+U3SVhtN9X90M2z9nVuVqlImPQ8rUP60t94yeIw0z1CjPLx5o45W3fym+ZxY6GEQGTFRecUmKJNFDT7DaJyOmrdFhRZKeRWv8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606913029919233.14932167610698; Wed, 2 Dec 2020 04:43:49 -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-220-ql5_ouC5N4ObqrtWOeqA7g-1; Wed, 02 Dec 2020 07:43:44 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9D5E8049CA; Wed, 2 Dec 2020 12:43:39 +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 9DEFC5C1B4; Wed, 2 Dec 2020 12:43:39 +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 3888E1809CA1; Wed, 2 Dec 2020 12:43:39 +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 0B2ChR0T003690 for ; Wed, 2 Dec 2020 07:43:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id B661360C0F; Wed, 2 Dec 2020 12:43:27 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 787E760BFA for ; Wed, 2 Dec 2020 12:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913028; 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=t5ryfdhTpYffyG7wvYUKJPBs5cltcDVVqLBxdD5efl4=; b=TthjC5PwqeEMP3+dwUzQ454WueP14uXU/QmbWcHbc1qPk9FIWxa/wK7KNOYTaKP3Dd2tOT 4njvSan4PqiW2KD5xBRlSyZ+83C7c7vqX4vcK/b0/E6Ir/KW7g6pB0G6IiTAyqL6StGR/R ByHgxJSGRWoMtll528XCVT+QAEht3hg= X-MC-Unique: ql5_ouC5N4ObqrtWOeqA7g-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 4/7] qemu: Fix resource leak and coding error in qemuDomainGetIOThreadsMon Date: Wed, 2 Dec 2020 07:43:18 -0500 Message-Id: <20201202124321.765271-5-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If qemuDomainGetIOThreadsMon fails because qemuDomainObjExitMonitor fails, then a -1 is returned which overwrites @niothreads causing a memory leak. Let's pass @niothreads instead. Found by Coverity. Signed-off-by: John Ferlan --- src/qemu/qemu_driver.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8eaa3ce68f..870159de47 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4972,17 +4972,16 @@ qemuDomainGetMaxVcpus(virDomainPtr dom) static int qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuMonitorIOThreadInfoPtr **iothreads) + qemuMonitorIOThreadInfoPtr **iothreads, + int *niothreads) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - int niothreads =3D 0; =20 qemuDomainObjEnterMonitor(driver, vm); - niothreads =3D qemuMonitorGetIOThreads(priv->mon, iothreads); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0) + *niothreads =3D qemuMonitorGetIOThreads(priv->mon, iothreads); + if (qemuDomainObjExitMonitor(driver, vm) < 0) return -1; - - return niothreads; + return 0; } =20 =20 @@ -5014,7 +5013,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, goto endjob; } =20 - if ((niothreads =3D qemuDomainGetIOThreadsMon(driver, vm, &iothreads))= < 0) + if (qemuDomainGetIOThreadsMon(driver, vm, &iothreads, &niothreads) < 0) goto endjob; =20 /* Nothing to do */ @@ -18507,7 +18506,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv =3D dom->privateData; size_t i; qemuMonitorIOThreadInfoPtr *iothreads =3D NULL; - int niothreads; + int niothreads =3D 0; int ret =3D -1; =20 if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) @@ -18516,8 +18515,8 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) return 0; =20 - if ((niothreads =3D qemuDomainGetIOThreadsMon(driver, dom, &iothreads)= ) < 0) - return -1; + if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < = 0) + goto cleanup; =20 /* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we mus= t free * it even if it returns 0 */ --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606913054; cv=none; d=zohomail.com; s=zohoarc; b=nDNQjTSSFZZ6kdbB53apNFJIUt4eSISFK6RCyzWNsOVk3/1CVC59EtUrblL7FMQKe7w5/K6mVPSfEkl8D+pYiSPOdufPmpAIy2l8ktXsGyK4WeSU+fILw6/SgADYBEnNktFk/MCvIrbJAUVcaobWtgxmo3wrcSIqn9YdT3nGcHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913054; 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=/sXtZYSbWgKrdinusGqUO88U+wpkrIIqbiknDMIWT6w=; b=WPBpeJAArT3GxTpsRMTzr7S7u1QbPF0j2WTtAFAWPKVsU8+hoMhSBnVwksEOH9rClwrVF/SHCGDvNyz7IH/7sg2OhyLk8lKy0al1MpmqXapITTPXCDiVpxNG7fhx4l/PSOKO/WyrR5Kp8QvrHHGLxG048Qaw0NSAmG4XPuk+ngU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606913054493667.4804041404734; Wed, 2 Dec 2020 04:44:14 -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-288-zfxHy9WrP8y1ieQgYnjs9g-1; Wed, 02 Dec 2020 07:44:11 -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 0987D107B463; Wed, 2 Dec 2020 12:44:06 +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 DA14E60C0F; Wed, 2 Dec 2020 12:44:05 +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 A0C971809CA7; Wed, 2 Dec 2020 12:44:05 +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 0B2ChSrS003695 for ; Wed, 2 Dec 2020 07:43:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2582360C0F; Wed, 2 Dec 2020 12:43:28 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC9A060BFA for ; Wed, 2 Dec 2020 12:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913053; 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=/sXtZYSbWgKrdinusGqUO88U+wpkrIIqbiknDMIWT6w=; b=JDBPEUzkMDMMq+1Z2xcuVXsKcEyig2iunZZ89BxLWxLRGtgp1pO7CAk3/srVU9jU6nEy9h wRtUXkRYE7GbfsB5b69pq2vT/aGuQ9dXGBLHUklQZZ36Slawu4K8biJKtZjNF9On0htT7f AP5iaKMh/l2K53uqTA4EZ0UXQhoWbio= X-MC-Unique: zfxHy9WrP8y1ieQgYnjs9g-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 5/7] logging: Resolve mem leak in virLogDaemonPreExecRestart Date: Wed, 2 Dec 2020 07:43:19 -0500 Message-Id: <20201202124321.765271-6-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Initialize and free @magic since virJSONValueObjectAppendString does not free it for us eventually. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/logging/log_daemon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index be93c63eb5..6b8f3b6fe5 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -508,7 +508,7 @@ virLogDaemonPreExecRestart(const char *state_file, virJSONValuePtr child; char *state =3D NULL; virJSONValuePtr object =3D virJSONValueNewObject(); - char *magic; + char *magic =3D NULL; =20 VIR_DEBUG("Running pre-restart exec"); =20 @@ -523,10 +523,8 @@ virLogDaemonPreExecRestart(const char *state_file, if (!(magic =3D virLogDaemonGetExecRestartMagic())) goto cleanup; =20 - if (virJSONValueObjectAppendString(object, "magic", magic) < 0) { - VIR_FREE(magic); + if (virJSONValueObjectAppendString(object, "magic", magic) < 0) goto cleanup; - } =20 if (!(child =3D virLogHandlerPreExecRestart(logDaemon->handler))) goto cleanup; @@ -559,6 +557,7 @@ virLogDaemonPreExecRestart(const char *state_file, abort(); /* This should be impossible to reach */ =20 cleanup: + VIR_FREE(magic); VIR_FREE(state); virJSONValueFree(object); return -1; --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606913034; cv=none; d=zohomail.com; s=zohoarc; b=hlJzO7s4ENfM2JW4jnmt0ntYwFbsG8VX+NX78ffsu62AemInE8Bn7TmLzAFUTQ+kTxPXVE4BA5aaicgPgAK5zjPOZJkxyt1nCgghIzWi3Iori5jjgQxBuZ8WtTbY9r9WNx/6O8/Eexhshx8VHzrX5wmsCnQ0RQ1SfNWKORBDw8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913034; 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=t1PxhgU/SPU71Km7mz06PQNwgwZS6ZAr1GreudbvfBU=; b=P86wLSqJWw310xftJarPTwSHPe1QzzbJehH3CDefA5LFsaEmKXQV3uSvSXP2HeRCnhA7khLJzwAj42U1WUQA3286+oQhZJXrzfSBxd21GkzlpBC7iGwB43Ob3yasC+KYeJfVOZgrhNCmQp7gBLgrA8PpWUzVwmxPPtT2cxVntug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606913034515280.518102396843; Wed, 2 Dec 2020 04:43:54 -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-429-b4j_9np2PaqC2SYDUZM40Q-1; Wed, 02 Dec 2020 07:43:51 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10943100C616; Wed, 2 Dec 2020 12:43:43 +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 DF4825C1B4; Wed, 2 Dec 2020 12:43:42 +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 819281809CA3; Wed, 2 Dec 2020 12:43:42 +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 0B2ChSHX003703 for ; Wed, 2 Dec 2020 07:43:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8761460C0F; Wed, 2 Dec 2020 12:43:28 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AC5F60BFA for ; Wed, 2 Dec 2020 12:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913033; 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=t1PxhgU/SPU71Km7mz06PQNwgwZS6ZAr1GreudbvfBU=; b=Ny+5TT5Pe7jId1JofWLWLRVXGSaj1b1d5jIZydsjX+Ubc3F0pRZ0SeuY2zb0ubyrMMpxcq LRz7dnxs92Zkm+hZ7pqkQtNE6lNq4kxXdkAf2j/Sppv/rYrVhAZD7V0WbPAQ4whDg94ush BynGo8vJIfmpfWdQxcyah6LVXzsx2NM= X-MC-Unique: b4j_9np2PaqC2SYDUZM40Q-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 6/7] locking: Resolve mem leak in virLockDaemonPreExecRestart Date: Wed, 2 Dec 2020 07:43:20 -0500 Message-Id: <20201202124321.765271-7-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Initialize and free @magic since virJSONValueObjectAppendString does not free it for us eventually. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/locking/lock_daemon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 57c7fb088f..851e9fc6f0 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -700,7 +700,7 @@ virLockDaemonPreExecRestart(const char *state_file, virJSONValuePtr child; char *state =3D NULL; virJSONValuePtr object =3D virJSONValueNewObject(); - char *magic; + char *magic =3D NULL; virHashKeyValuePairPtr pairs =3D NULL, tmp; virJSONValuePtr lockspaces; =20 @@ -748,10 +748,8 @@ virLockDaemonPreExecRestart(const char *state_file, if (!(magic =3D virLockDaemonGetExecRestartMagic())) goto cleanup; =20 - if (virJSONValueObjectAppendString(object, "magic", magic) < 0) { - VIR_FREE(magic); + if (virJSONValueObjectAppendString(object, "magic", magic) < 0) goto cleanup; - } =20 if (!(state =3D virJSONValueToString(object, true))) goto cleanup; @@ -775,6 +773,7 @@ virLockDaemonPreExecRestart(const char *state_file, abort(); /* This should be impossible to reach */ =20 cleanup: + VIR_FREE(magic); VIR_FREE(pairs); VIR_FREE(state); virJSONValueFree(object); --=20 2.28.0 From nobody Sun Feb 8 00:35:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606913058; cv=none; d=zohomail.com; s=zohoarc; b=SmtlkLiVtoKZojj7Ei8yQmtwTv495mDgX2D8NPPwbL2aevp58YRTtz0uCvWW77Pfe1OCG+ICrLkgzLvEtqjqWEbuUHoqcTscp70pKSBiYtkby24HZDRvu/Jcrxizs86kMMr2wWDj8SqBLx5bu2fPvBWLf0tpq0h79O9+81DcWvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913058; 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=GJ6AsM0RbNIUPdOMkx+8haJLRaAfiJowPSqqgA0Il3Q=; b=a+3Yv7K/RjGa9ilCMNM/cQ122L8mPHoXon/voJyxZrCiW+rf2oNlvF5ppLYYM1/JYIkXePFwCXfKoEYvoDKcP9PzAQqn9hFiphliWTgXQ1k4RfTb9yf5D55+bVeWkpLgWI78iy88K5IySvZNre/diG7RjW9uwqkLmwsm8x9mAZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606913058154583.0536063008892; Wed, 2 Dec 2020 04:44:18 -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-307-oBZ9H-mbOJ6pkwN4m1fU7A-1; Wed, 02 Dec 2020 07:44:14 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE5C78144E9; Wed, 2 Dec 2020 12:44:08 +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 CDFF65C224; Wed, 2 Dec 2020 12:44:08 +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 9799C1809CA8; Wed, 2 Dec 2020 12:44:08 +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 0B2ChSQl003713 for ; Wed, 2 Dec 2020 07:43:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id E9DAB60C0F; Wed, 2 Dec 2020 12:43:28 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD59060BFA for ; Wed, 2 Dec 2020 12:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913057; 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=GJ6AsM0RbNIUPdOMkx+8haJLRaAfiJowPSqqgA0Il3Q=; b=JclqBacKY1beCBMLR0cwkdhSoTdB7X35Fx9Diq0JsfqReocRpTAvc7lP/NWnIxPWHiOgNG d3Tagbufejxk31tvVm+Q1EK0gLBmkw5EboZGBu617hSOJJdYU4eYGPPBrTeb9ywArODpXM uo6dfFwovawDQluI2CVVUHZUIjNF4Kc= X-MC-Unique: oBZ9H-mbOJ6pkwN4m1fU7A-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 7/7] qemu: Fix some issues in virQEMUDriverConfigLoadNVRAMEntry Date: Wed, 2 Dec 2020 07:43:21 -0500 Message-Id: <20201202124321.765271-8-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit c4f4e195 fixed a double free, but if the code returns before we realloc the list and virFirmwareFreeList was called with cfg->nfirmwares > 0 (e.g. during virQEMUDriverConfigDispose), then it would be rather disasterous. So let's reinitialze that too to indicate the list is empty. Coverity pointed out that using nvram[0] as a guard to reallocating the list could lead to a possible NULL deref. While nvram[0] may always be true in this case, if it wasn't then the subsequent for loop would fail. Just reallocate always regardless - even if nfirmwares =3D=3D 0 as virFirmwareFreeList will free it for us anyway. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index cbdde0c0dc..690cfd39f9 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -835,6 +835,7 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPt= r cfg, =20 virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); cfg->firmwares =3D NULL; + cfg->nfirmwares =3D 0; =20 if (qemuFirmwareFetchConfigs(&fwList, privileged) < 0) return -1; @@ -843,13 +844,11 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfig= Ptr cfg, VIR_WARN("Obsolete nvram variable is set while firmware metada= ta " "files found. Note that the nvram config file variabl= e is " "going to be ignored."); - cfg->nfirmwares =3D 0; return 0; } =20 cfg->nfirmwares =3D virStringListLength((const char *const *)nvram= ); - if (nvram[0]) - cfg->firmwares =3D g_new0(virFirmwarePtr, cfg->nfirmwares); + cfg->firmwares =3D g_new0(virFirmwarePtr, cfg->nfirmwares); =20 for (i =3D 0; nvram[i] !=3D NULL; i++) { cfg->firmwares[i] =3D g_new0(virFirmware, 1); --=20 2.28.0