From nobody Thu Apr 07 14:52:37 2022 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 32ECF1A84EC5; Thu, 7 Apr 2022 14:52:38 +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 4KZ49f0xc6z4vDM; Thu, 7 Apr 2022 14:52:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649343158; 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=jPXVig89v3rXQJg17Gk6ZAkOL2anBQs2PP7kPCRGwC4=; b=ixRTWj/TQeemgpSp5yVhMEeYIOd08oYc5k03ZQkVuoHWRVGdFXgDWXz5a/p4zC6uraImvw zoXovU0HSIdTw4D1tRB6ZOs931P29ddcfq9niN+4YHki7S9V7PUBzGADcC7Iw2wug3+Q9S iTnb9VGq8mUjLooAQ7IUDtom/C2riq42rTXjjfTi6nnywYXWS4+hkOu2vbJ9xXlR9G8lIE bmEHrD6NNCgAQlXBdV8CgOs2HFNZEuj6rzUmtZxd1+jVSV4++5KGavB6n5nft2RH3tNOuU N7rBOrc7Ksj0GoV+1sZNxl5OsNOGSo9IKtTT1SPG2flMf/HaZNNuySk4z5NfEA== 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 00C021267E; Thu, 7 Apr 2022 14:52:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 237EqbrU039425; Thu, 7 Apr 2022 14:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 237EqbCZ039424; Thu, 7 Apr 2022 14:52:37 GMT (envelope-from git) Date: Thu, 7 Apr 2022 14:52:37 GMT Message-Id: <202204071452.237EqbCZ039424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0bd468ea3fe4 - main - pf: fix memory leak 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0bd468ea3fe4f695e0a355becc1b4f5f5296402c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649343158; 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=jPXVig89v3rXQJg17Gk6ZAkOL2anBQs2PP7kPCRGwC4=; b=vefxHrmiqRTQ5NeQ8hl7ZJ/8C2+Poxa7bNUvbZRyaq00gnb4dwf+tCaMOM3RieDiFHMvaE eV84esrG8C5sm9yriMTUSYnS7a65GlOjhGumAnZjjom8bxEjKfpxqMJYQP4pr5xD8QnII/ r8pSC5oJ+xXYrljUm6COz+iNQAXnX8aVN3ehMoKUI6f4HErANiwcOOr7GVfUoi+e6bLFRU RkRVzEqun1Yx1RoAYAyjua1dnz25oZ1H7Xep/AjUGp42BUpMXzYBteURBU3cPIl/MdHNcW u4me4BR9gXPYQ4bEjTAcb2t1pnQDWBDZXrYXOWjaRhjcrydvyglZ2fqvvfbL3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649343158; a=rsa-sha256; cv=none; b=qwJDB6LFEl0IESGJ9XynbJ7Vj/tnK2Fby1/wA9worMZXjh+jOUox28qygILyj2NvMTF2du uZDXFssTNKZYSMecYj7tyLovZK6xKF5BYvwg8IBuiKE8h+fvxDctCbHDwijEoUMGMXhlis BpancfKkEIpjH6S1ww0zICQAXU8MRibEWd6YxVbIjzXg8dhXk4nKc5goasMpPSTX/Wtmrq ZjOKEtt5jEE0ahgWWYDTH8UKIxl/rOgrnTmiORAvkwHv1qzNhJ8tdgtmc0AVQ/2OiJab1E b4pXJZWsLgXSsPGcCASqFJiIz6jx1JVAANZ2W+jbjPGywJm5LKAUFv/q4tNobQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0bd468ea3fe4f695e0a355becc1b4f5f5296402c commit 0bd468ea3fe4f695e0a355becc1b4f5f5296402c Author: Kristof Provost AuthorDate: 2022-04-07 06:35:12 +0000 Commit: Kristof Provost CommitDate: 2022-04-07 12:51:52 +0000 pf: fix memory leak The nvlist is allocated in pf_keth_rule_to_nveth_rule(). There's no need to allocate one in the calling function. Especially not as we overwrite the pointer to the new nvlist with the one allocated by pf_keth_rule_to_nveth_rule(), leaking memory. Reported by: Coverity CID: 1476128 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 22adc141846d..a8f9261111db 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2720,8 +2720,6 @@ DIOCGETETHRULES_error: free(nvlpacked, M_TEMP); nvlpacked = NULL; - nvl = nvlist_create(0); - rule = TAILQ_FIRST(rs->active.rules); while ((rule != NULL) && (rule->nr != nr)) rule = TAILQ_NEXT(rule, entries);