From nobody Thu Aug 01 17:35:57 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WZbj94jcPz5T5yY; Thu, 01 Aug 2024 17:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZbj935yTz4tpZ; Thu, 1 Aug 2024 17:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722533757; h=from:from: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; bh=bGByeNjqhJj9cFwsFNq44akymCAGtt8zkh3zy82tkso=; b=Q1ADoShHffqwmXVvTh4uPCAFODvreB3fHVI6yO5//3CYSHwsjinAjcn+LJoaIpG+qzTFJK HpbwPxNR/5YAW6c6UPVKFz0vVHifuSmu7G8tUxpgP4sJA9mEcRDo53NmbX+jg3sJXY8Val Fb6QaWIh62Yeiy0CISPQlvsAGMmXWHsvlK17efHgE4VMRCHF8AxeA5PBE6PT+7ZVHacVit bLSMd8Z/QOi+pgHHsGVBHeJIlo2KelLLTUA3YI4fBzTNt19ncQjqQH3TlPyJb6onpz3t4Z BHDtuS3jHby1NYGwpWTnJhnraZCi+/NPF80g8Hq0GEaV8lxDAb8AaiooA/JbuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722533757; a=rsa-sha256; cv=none; b=X6EBP3NfgCPuVxPZfNEv2sXlSmQFsZ+ciL+qj5KZb/aHQNr2nn4Acos2BGU+4juArpbysq j/DfBlu2gz6XWQa9RnOUirWAI0tXY8/joMMq08updiTkcHsMMytc6qDrbHgycGSKAro2ZH Xel3E8PGJ73YFYyjL398zvDU65w8esrk/xs9qYWHUEalNhn7qW4DtTlgPLEgZGrdh/ihhC D7hCG0iWwnjQ5cHeKqMPbNd0PyiSNB0a7+zhp41pTJovkkwwl3UbSx17AVz1FtX5R1JEkX PQCKlWdWPr0a2oFDI3U4z1MT/vsAVD1reQ1IlonDI6h+i4YmqjvOB/4TxfM56A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722533757; h=from:from: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; bh=bGByeNjqhJj9cFwsFNq44akymCAGtt8zkh3zy82tkso=; b=W7N7sBd7Le4y/IOkQ7M+ynyDLf6n8aM5vCA2G7WfEfE25+igiOFNZYTg7BreKGm6JxDZra ZCkX1dFLaZx7//X2EE3fvtTxLxmOoyLE1ZDtRoEhYMZFvNFzoQr/IwHguS9NnNUxA2Jk3/ hpJvVFggCVQL39A6PbWI6niNFw43i1bAVWnejgv+SWAJJjX050ndfRZw9kqf6pNZabeDK2 ztdHv9kpizqAgrySleJ5wbaswVheHhQsOvX5fUG132CoP4mWCXoA66vxtY/ZpEPofxSYiW rrQhrrpwokq4bB0FRaivam60NkI5mXJGkzqu3HIW6/06JeIW2VHDrleZWrorGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WZbj92j3gzt5B; Thu, 1 Aug 2024 17:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 471HZvbw031739; Thu, 1 Aug 2024 17:35:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471HZvWk031736; Thu, 1 Aug 2024 17:35:57 GMT (envelope-from git) Date: Thu, 1 Aug 2024 17:35:57 GMT Message-Id: <202408011735.471HZvWk031736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 88069992b210 - stable/14 - bhyve: avoid resource leak in error path List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 88069992b210f659327024babb80589d86a2c119 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=88069992b210f659327024babb80589d86a2c119 commit 88069992b210f659327024babb80589d86a2c119 Author: Pierre Pronchery AuthorDate: 2024-05-16 16:55:54 +0000 Commit: Ed Maste CommitDate: 2024-08-01 17:34:50 +0000 bhyve: avoid resource leak in error path In e820_finalize(), the e820_fwcfg_item variable, containing the etc/e820 file (for the e820 table from the BIOS) is not free()'d when it could not be added to the QEMU firmware configuration device (fw_cfg). Reported by: Coverity Scan CID: 1522761 Reviewed by: corvink, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45223 (cherry picked from commit e9806d21282d3d5486b99b5c7062b490b00d8323) --- usr.sbin/bhyve/amd64/e820.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/bhyve/amd64/e820.c b/usr.sbin/bhyve/amd64/e820.c index 456ce0330b50..9d95ec8ce688 100644 --- a/usr.sbin/bhyve/amd64/e820.c +++ b/usr.sbin/bhyve/amd64/e820.c @@ -483,6 +483,8 @@ e820_finalize(void) e820_fwcfg_item->size, e820_fwcfg_item->data); if (error != 0) { warnx("could not add qemu fwcfg etc/e820"); + free(e820_fwcfg_item->data); + free(e820_fwcfg_item); return (error); } free(e820_fwcfg_item);