From nobody Fri Jun 27 15:16:14 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 4bTJzf4rmxz5yvM1; Fri, 27 Jun 2025 15:16:14 +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 4bTJzf259kz3YWv; Fri, 27 Jun 2025 15:16:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037374; 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=kW3BCJcQghfdTkYfqOZnbjwuTDuPevlbgjgqIIhTbJ4=; b=NF1/yPSXyvJnmKPSNOqdx/JiLaPPdanW5cliDYTnziscBs57OMvTaw3RkwRp248kqebDXq QYhsotmSlOGs4iWv323OtY0XhRFgx0bbi1Lz/Ha+ULCIF5rNZWmQDvd2me8b529Sxx0xQT VzM79y+d/PaxRkfpqHMePEhbMpB1xLXAMxr50WP5CN0OgrdiPj2IriRWokWLPSzecPXeqV BzpwDv+AzSQWCHLPYNjS8/8RYplc6Welq8MJxc1Fv1qDkQ9dKbq/fFA/2yKwKP31unDfSS sKlqKqTlnqYUQVIzsArvjnkmNlg2FtGGwb7WDiqpfiXlIhTpzHal/4FZVfYF/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037374; 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=kW3BCJcQghfdTkYfqOZnbjwuTDuPevlbgjgqIIhTbJ4=; b=biNXATe6IUe6NIwSe6r0sHYswjyvYgc1tZfWrLsSnR1dNLQ6mVaX/kcvsBQZE9u4xqPbFx TKGmLypitKVrC1+c7U3sX9l+rm75OCzwWkjtRJMw2AX646Y/fuSI8SarcEuT80Bj2glMSE p34Y3JDk0F7PjpwGgGAPhkHU1DiX7/3WIniDL9FydcxQSL5HAMGryAyb0V7ByjFYVA3XeS iK4VMF78CLYa+50+qImS8P7WRfwDjehipss7y+JekyNSxeNFApKNZDEIfsjl5zBrj7Xyw/ 9l3SN6dOmElobnLmU83q5aICQp6Onxpd7M+qFitMOGbZMWqQqJNxHDeb5f/4mg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751037374; a=rsa-sha256; cv=none; b=TQVxlv+WrIfqxvvKis3K23j6Kb4wiKSm7ktSet+Uv9ZOUTXzyaGRZwEEEC8Nne5yyBq9Vl co49YCdtySgBnd1e/7oc+pte5U6V4rQGYJ5KQJ7isg0U7xD7+F/+slQGPYXRHYxiMTrL8j shnMhY2oP3DvplMthWuT6cQNz53Eyt4B24zeE/ysMME6HU+nAxNnj5UjUdNz+8w08LXTHQ eLheke4ExRwU7Dp8cLN96+pNtvRfX7Uf9hzUgOvVUHr1oVsk3/KJI9xoy+qorJhvNq2imY Uxs9QkBoRYbHPtWM/fUdXcsA3/81zA6Jlqap2uRKFOzZLLSFaZk8xldS5uGMXg== 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 4bTJzf1fznztM2; Fri, 27 Jun 2025 15:16:14 +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 55RFGE5h049155; Fri, 27 Jun 2025 15:16:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55RFGE8B049152; Fri, 27 Jun 2025 15:16:14 GMT (envelope-from git) Date: Fri, 27 Jun 2025 15:16:14 GMT Message-Id: <202506271516.55RFGE8B049152@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: 753da351598a - main - pfctl: plug some memory leaks 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: 753da351598a381abe639a62621f5dae28a7bfe6 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=753da351598a381abe639a62621f5dae28a7bfe6 commit 753da351598a381abe639a62621f5dae28a7bfe6 Author: Kristof Provost AuthorDate: 2025-06-24 11:39:24 +0000 Commit: Kristof Provost CommitDate: 2025-06-27 14:55:16 +0000 pfctl: plug some memory leaks found by parfait, ok henning Obtained from: OpenBSD, deraadt , 2f2ceddc40 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 2 ++ sbin/pfctl/pfctl.c | 2 +- sbin/pfctl/pfctl_optimize.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index e4cd4883e2c9..8afef160b205 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7143,6 +7143,8 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { + if (nfile) + free(nfile); warn("malloc"); return (NULL); } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 15766eb9b704..8435f69e91e0 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -2261,7 +2261,7 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, struct pfctl_ruleset *rs; struct pfctl_eth_ruleset *ethrs; struct pfr_table trs; - char *path; + char *path = NULL; int osize; RB_INIT(&pf_anchors); diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index d6417e8e73a1..b4ffcbebb1bb 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -922,6 +922,7 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) if (pfctl_get_rule_h(pf->h, nr, rules.ticket, "", PF_PASS, &rule, anchor_call)) { warn("DIOCGETRULENV"); + free(por); return (1); } memcpy(&por->por_rule, &rule, sizeof(por->por_rule));