From nobody Fri Dec 01 15:01:13 2023 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 4ShbqF3j5rz52jXN; Fri, 1 Dec 2023 15:01:13 +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 4ShbqF3FPxz3NLp; Fri, 1 Dec 2023 15:01:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701442873; 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=ASXPEyhQDCSCmk4TY2G4BreLENovB5p9ZzeFW7F32t0=; b=HE4erkswctQb8AoH/T/3dG27YPz4uaswggulDm6Der+a2Sjh0DRYw5J/YW3CeADfJ1zinx TUwts9Hqmw7SL7J/oixuQ1RJ6e70TaA4blGnprAmnF9R6RNq+kLWcOS3KGuOnu5sh9ZKIM 4qIzBwKD65mwc5qx6HRPBzAMfDXxxfu4BTniUd4JR3pxlKVpDLbol5vGuT9a0ABXPCk9Ng Usz3uQ3nBqmxR+OJxcRVGZkKnsW+3ggZcmkygRVh9jngtBHC7j8F5tKu1pPlf+qwLsDJw4 51i9xT70f5qaGjR+/WjAJUm5Kfba3dIA6co397Un7RBqNJ+VJRbxwzDABrB3tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701442873; 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=ASXPEyhQDCSCmk4TY2G4BreLENovB5p9ZzeFW7F32t0=; b=FJvYR2w/3n1my9Nu0Ev2rhEBenW+gzXbxycbXksP6h++gf7LIOT0WaQxDKgdrnIHHWS9eD FVWBhgz6g+c9aA/n9Q8tu2bHU4TsDtZfPCrgU1FrBrvsPyaExuo+ijDKEbgLfPclGp9MjI 0L/vgSCeg3hPmGLn5pdc3WRLCnrR0oWGWQvxFDI772wHqU8JYmYPNM6ANkeGvG5uO/Ny8m ntED3HQ9t0jb+BeDWiR76OYqyoDX/K5+Uu0/SX2X33f5LcTIX3rB9bdrHvbYVtE9wfNWKj Z5hkJu1Iw/lILXf6S6W3Ao1mTLpjQG4Kef1x6XBwNyzR8H0P/tRkkNxKLa99pA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701442873; a=rsa-sha256; cv=none; b=ZaKWEmEtwaaR4mmkymtai8DzhxH5naPfdBhCsAIs+kNOApkaT8K+FvutoMdjO4ZlJXM0+1 ooNK25D+/gizxGBBqzcZWtBH0I5naF9C2XgHHIGfwIj1gaWaPVwmmsKO29YH1px3pAzzkf fRsGVth7RxzB9xDlA31ZLhLb4c34E5q7r/oozusEMKjzilti+ehtfBg72vdmZ7Ex+o584q GJhmkrL4Xq+39tEg6qAN0E+WnkdgWLFkllkCy3f1kJoxdvKJDNnoiT6udnD2IeH8PB0jAC FYoZ7Aajt0XLWE70V6WcODzst5aG36j8rzZIuMYMhUE2XHVl4W+ch+gYETdK2g== 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 4ShbqF2KHhzdJ3; Fri, 1 Dec 2023 15:01:13 +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 3B1F1DWi006135; Fri, 1 Dec 2023 15:01:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B1F1DDF006132; Fri, 1 Dec 2023 15:01:13 GMT (envelope-from git) Date: Fri, 1 Dec 2023 15:01:13 GMT Message-Id: <202312011501.3B1F1DDF006132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1cc96501e580 - main - bhyve: Fix a leak that happens when we fail to load a hostfwd rule 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cc96501e58057fba62cdebd514cdc9197d6e97c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1cc96501e58057fba62cdebd514cdc9197d6e97c commit 1cc96501e58057fba62cdebd514cdc9197d6e97c Author: Mark Johnston AuthorDate: 2023-12-01 14:46:31 +0000 Commit: Mark Johnston CommitDate: 2023-12-01 14:46:31 +0000 bhyve: Fix a leak that happens when we fail to load a hostfwd rule Reported by: Coverity Fixes: c5359e2af5ab ("bhyve: Add a slirp network backend") --- usr.sbin/bhyve/net_backend_slirp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/net_backend_slirp.c b/usr.sbin/bhyve/net_backend_slirp.c index 1c414f87084c..1d6ed45b90f2 100644 --- a/usr.sbin/bhyve/net_backend_slirp.c +++ b/usr.sbin/bhyve/net_backend_slirp.c @@ -502,8 +502,10 @@ _slirp_init(struct net_backend *be, const char *devname __unused, goto err; while ((rule = strsep(&rules, ";")) != NULL) { error = config_one_hostfwd(priv, rule); - if (error != 0) + if (error != 0) { + free(tofree); goto err; + } } free(tofree); }