From nobody Fri May 17 16:26:58 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 4Vgsmg1RwRz5LQVJ; Fri, 17 May 2024 16:26:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vgsmg106bz4T9l; Fri, 17 May 2024 16:26:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715963219; 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=tzw/XtfgeqC+r8WRtEXb4UdF7CFcG7+q9C+NABlrQ+A=; b=vQHNS6lW7KzVbY1/HiQjved0PWlWT0a8NYNkdWbQcLxWlcWZf4vMjqCE8eufJJ86GdEt7x Rl9u29ZLTXDkIeCiE1OVn7YncdMgsudcazD6UCvfCmbj6I1xkTeRj2B4ZZZeWmSyke6hkq pDEtdD5TokjIxVicfFfEeNWHqycreFtCc+jPI3RRv2vT7xe1QMYb9tNJqb7fa6cV3U6D0n tNqOFdS8b39EnEsQvfKrO+o70idgpN13ol5shx6Mip8ZOsE6qh5kpTU/lYNErfTfe58fWy U86rjB/fVXLCUgZpHTqJ+AoZudLQaJfVE2+zfGiADuRLo7vSCd5L5fPX9Bph4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715963219; a=rsa-sha256; cv=none; b=x8HGzXsKh4+d8HBPRh65KqT9psPlJUf/bZ+8JBYE6SalH9UHYxXmUfqGfCBoOk7ET7qXUt pjH2YNWDc2RMijENTiEKyRXHyVtiuCbOA0LOQyKqvrRbWfKVH4eCV/dgn4vlE2jfwyxS0e 5qxuqszjsFSqDaKKkj8FFfinUMI+xH3SlWIAuyC5uIeLRltE520dAtoZZeaSAdGcpoUIXu r/Nm3knEHu7RVcXeZkitO7x9gYAJJx3azFOMg3jwQKcxxlkmdRJs5J9uzAdEgBj/iqBhlD UXk8HXYS4KvGlhpG6NtIYrhRyKnUuIAdK4rZUOhbWnSRq/nf6P3edpZti68y1Q== 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=1715963219; 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=tzw/XtfgeqC+r8WRtEXb4UdF7CFcG7+q9C+NABlrQ+A=; b=UZEYPlh1+6alsa3+Wb0+qzEyMtIOZK2QEndIjjV/Ry1sgiw9/wX22YZRQv5eaWPNZS3pM1 1mKe76vpEnFaZ9iwIoYrD8FbbIuqYyPB2gtIBdmUIqfaIvjyMgdH0BA2lgDu9lfE4hYG1e dk2zV3neqbwaqWdu6oEo6IPIwrYub8P7HNDnYD8zmpuGs+46WieILfHboIkw6bSUyAMAs1 xaSltD4zBLmuhu9K5Ivy0xtqRoYiFX2JrBHv2lCGwG1LIX3u8/XuPrR75ZsEERR5JZJZEX DINf8s32zE3iN5ydBaRIn76CFWSmbhyy1iD0nWnZyU9L49sb2Z2yaZvl3Ng6Ng== 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 4Vgsmg0b9kzqJD; Fri, 17 May 2024 16:26:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44HGQwEO082978; Fri, 17 May 2024 16:26:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HGQwrd082975; Fri, 17 May 2024 16:26:58 GMT (envelope-from git) Date: Fri, 17 May 2024 16:26:58 GMT Message-Id: <202405171626.44HGQwrd082975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: e9806d21282d - main - 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/main X-Git-Reftype: branch X-Git-Commit: e9806d21282d3d5486b99b5c7062b490b00d8323 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e9806d21282d3d5486b99b5c7062b490b00d8323 commit e9806d21282d3d5486b99b5c7062b490b00d8323 Author: Pierre Pronchery AuthorDate: 2024-05-16 16:55:54 +0000 Commit: Ed Maste CommitDate: 2024-05-17 16:26:27 +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 --- 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);