From nobody Wed Apr 16 18:02:50 2025 X-Original-To: dev-commits-src-main@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 4Zd8575N3Wz5t2QN; Wed, 16 Apr 2025 18:02:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zd85661pJz3QxG; Wed, 16 Apr 2025 18:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744826570; 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=fD3V6zKGCCjNEfZKehPcMNVTGB87o6CTWJt2vUchXmk=; b=sCiOq40ygY3BZAHqpEIIaJYxaIINHF2ZawLAZH919Z0MEpHRdBwAe+ENFFQrPCpaQPJHEO Jme07RiT6q4t3BnuokRHGyBReLvz1N7jKYYucAxAVc3lz34P5ydxjvfyBrjPnm5PRmsiEu t81N0kPgrvybvmgm9dcxI83upYfBFiejQxgSmmw3sAc1N9sBs7IKgKzxtS/FD6K1fY55Ny nuO1FNiChinmbIhdz4vnYnlJ9E0uAdsIzV3EPzD+DrPH4lVTxyDjidnqDD8gSU575zU8QH PASY4/TWO/R0iplwK5eJgWO6gNNYmF0lZxWiGnuOUphUocfeQpMR+UEoc7SWhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744826570; a=rsa-sha256; cv=none; b=P5ESStDDklfQcxaGTomlJCTLYLdFSNzNmfuYuy+WwtQTiS/H0T6FZsRH1C8Sd6fSiY/0lZ ofoArbPRMcikaf9Uafn4pUP3IAoL5pYRUk9CiwVAWu3TxQOnd2O6mjNisiHU09lrNzuFzo ahzqJNyI2ZJ2DhHyyLnbw5n1R2LCigV/2LX2VBw6z20uGJo98Q4QF4LvQgjSZsUZmkDpwR ib5or0z8da4oinr86ulDbuWA2I1VMz3EgG4Q3vBFyHvIbXhB/+u76sCRpjVBRexDYjccG1 q/Uau2BHKL386pdcsBBPEdCOeOep9E779PevXJj1LGYNSpJV3dOut7ODgqamuw== 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=1744826570; 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=fD3V6zKGCCjNEfZKehPcMNVTGB87o6CTWJt2vUchXmk=; b=X3op4S25fO5XZ7CVpAYqrA9tXyJcvvNq0yt9dsi6lXFxub1kNc8Z8TBdqo4O4iEKvFoGVw wahayh7xX28/pAd3gpZMVJV3z8wQ6vpZuDEkMei/ZsuDObxRisdVG5/fOTcAmwbX4Kplok 9+DqpJExcEkn6flhA5+hlpGLCn/olqAy4AMPWB2hdPd5L7y5AlJc/ii54Yrs/RX13H/PMW mgRfIhmlVFQWkp4m6oG16vw83sIsswK9Z/4YGIzoEtTlEcTFjU5JADtAR/0kk7XGP4Zfwd CNFp0AUedX8DV9m4q2dKqvyW+/u9GYPvR3mMp/ZwtPJmSe/9VVBluCjEXgoRuA== 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 4Zd8563c1Sz1S62; Wed, 16 Apr 2025 18:02:50 +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 53GI2oAa075679; Wed, 16 Apr 2025 18:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53GI2oCT075676; Wed, 16 Apr 2025 18:02:50 GMT (envelope-from git) Date: Wed, 16 Apr 2025 18:02:50 GMT Message-Id: <202504161802.53GI2oCT075676@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: 162dfe766b2a - main - pfctl: Remove NULL-checks before free(). ok tb@ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 162dfe766b2a62fb875a47796ffb032242ff5124 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=162dfe766b2a62fb875a47796ffb032242ff5124 commit 162dfe766b2a62fb875a47796ffb032242ff5124 Author: Kristof Provost AuthorDate: 2025-04-15 15:23:01 +0000 Commit: Kristof Provost CommitDate: 2025-04-16 14:23:47 +0000 pfctl: Remove NULL-checks before free(). ok tb@ Obtained from: OpenBSD, mmcc , 5ce950dec1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_osfp.c | 30 ++++++++++-------------------- sbin/pfctl/pfctl_radix.c | 3 +-- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/sbin/pfctl/pfctl_osfp.c b/sbin/pfctl/pfctl_osfp.c index 649c1e8a2c3b..3a94c2e8c81b 100644 --- a/sbin/pfctl/pfctl_osfp.c +++ b/sbin/pfctl/pfctl_osfp.c @@ -112,16 +112,11 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename) while ((line = fgetln(in, &len)) != NULL) { lineno++; - if (class) - free(class); - if (version) - free(version); - if (subtype) - free(subtype); - if (desc) - free(desc); - if (tcpopts) - free(tcpopts); + free(class); + free(version); + free(subtype); + free(desc); + free(tcpopts); class = version = subtype = desc = tcpopts = NULL; memset(&fp, 0, sizeof(fp)); @@ -250,16 +245,11 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename) add_fingerprint(dev, opts, &fp); } - if (class) - free(class); - if (version) - free(version); - if (subtype) - free(subtype); - if (desc) - free(desc); - if (tcpopts) - free(tcpopts); + free(class); + free(version); + free(subtype); + free(desc); + free(tcpopts); fclose(in); diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c index 1d1918e29f44..e4659a30b234 100644 --- a/sbin/pfctl/pfctl_radix.c +++ b/sbin/pfctl/pfctl_radix.c @@ -406,8 +406,7 @@ pfr_buf_clear(struct pfr_buffer *b) { if (b == NULL) return; - if (b->pfrb_caddr != NULL) - free(b->pfrb_caddr); + free(b->pfrb_caddr); b->pfrb_caddr = NULL; b->pfrb_size = b->pfrb_msize = 0; }