From nobody Mon Dec 11 21:02:53 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 4SpvMx71NZz545Bb; Mon, 11 Dec 2023 21:02:53 +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 4SpvMx6CsDz4p5l; Mon, 11 Dec 2023 21:02:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702328573; 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=aaF3hxDsvbLmTBev2TLRlIXHQuAVx+TIvz9WFUKxGRc=; b=HP8JoKFk46z8CtpYEqRwNAf7NhbmA0Xcrdmiyh2HrizwBL124IX8YUzKJM4ufC3dWgkJXT vTZD8xXdwdiZgTCroTFF7FS9ZNMJFVxarGC/+icLnuMR3zp1OhXEphQ11u+8/4qLzhfcgh Q0TEQHPTYLZCFwrUqvoRG/2o9/GqLOWMaYkoDRGH9SEhTOZgf0UCdn0UN029eh7MahQ24W +HYK5/9p7y4ADeXaLUI9Da0fe3UpWfowlPw31OrR2G9h6lWI3gcqoz2P6F35LIxqaDN4K0 MS2E6B/mbm3JslVg1YSbjt6S/sBOPPfs6pvY+WlfdWQleyROvCtqm8bSgx5nww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702328573; a=rsa-sha256; cv=none; b=wuvq+xOE4hpVMdVZIg9POkrk3aieNxAu/kkDpwjrBz5WWbUxpVpmFpYZ3lheTD/D3Jibzi /CXnD+W/kFVkRzYOLtdxFs6kZZOIJS8kPKH80tBdYf9cFm76dsvYaykuNHBZx3pccIX7nB aS6TJS1FzEf/MY40hFT52UzVqeW6YbbsT0Jm+slkwQSmOya9bAVB5Z0+7zhI+Abk59ZmDI TG9AhZMkz3858sWnwj/RQmvyZDrBpB9KvncJE2NO7fKsX9qCmZMCRdQUWX6hOh0m7x8hC8 iiUtjoMd9ZI7gjz18Y8VX22WltGsYcIxfkdpSKdMw4IwtF0qEDL9ds92z4pAyg== 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=1702328573; 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=aaF3hxDsvbLmTBev2TLRlIXHQuAVx+TIvz9WFUKxGRc=; b=VJA3ItTOOFfa2BFrmHuks0/jJ7rPBpAlV+7/lLMupQireQJjgQc6OWD703ZaKnJ0M9jDAB Qq771rPZws3r6ewJn2ZF4HAd1CMBCfpAsYwlGhCxQQV58JE7487GgjQgkTW4ouBIdx3jTA 5D+GH5JsfzWzB87N5jiJPpIOfjkdD2BmPFr+bu5AnpAl+h30EvrYQGoZiEEXulWs9rutG+ UIg+1ai3OwxFkUjU5ioRyX3kO0mxcrgp7JHkKgoQ4UkuDUamvUFwsLUuWpfnAxB9rQiSTF 1YnfDPA1Jx97ZDtUR9e0g2G9HVzQPzooA/nNKTlDq0ch1rpX7NXpX//BTU05Mg== 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 4SpvMx5KyZzmnL; Mon, 11 Dec 2023 21:02:53 +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 3BBL2r6G057796; Mon, 11 Dec 2023 21:02:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BBL2rdU057793; Mon, 11 Dec 2023 21:02:53 GMT (envelope-from git) Date: Mon, 11 Dec 2023 21:02:53 GMT Message-Id: <202312112102.3BBL2rdU057793@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: e249f5daa41f - main - pf: fix memory leak on rule add parse failure 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: e249f5daa41f73eb293490ed93d06d1fefa08d82 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e249f5daa41f73eb293490ed93d06d1fefa08d82 commit e249f5daa41f73eb293490ed93d06d1fefa08d82 Author: Kristof Provost AuthorDate: 2023-12-11 19:43:20 +0000 Commit: Kristof Provost CommitDate: 2023-12-11 19:53:00 +0000 pf: fix memory leak on rule add parse failure Reported by: Igor Ostapenko Reviewed by: Igor Ostapenko Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_nl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 86cc5ba9cc91..67a7392ae448 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -625,8 +625,10 @@ pf_handle_addrule(struct nlmsghdr *hdr, struct nl_pstate *npt) attrs.rule = pf_krule_alloc(); error = nl_parse_nlmsg(hdr, &addrule_parser, npt, &attrs); - if (error != 0) + if (error != 0) { + pf_free_rule(attrs.rule); return (error); + } error = pf_ioctl_addrule(attrs.rule, attrs.ticket, attrs.pool_ticket, attrs.anchor, attrs.anchor_call, nlp_get_cred(npt->nlp)->cr_uid,