From nobody Fri Jun 27 15:16:15 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 4bTJzg6R2Xz5yvJf; Fri, 27 Jun 2025 15:16:15 +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 4bTJzg3FBMz3Ydd; Fri, 27 Jun 2025 15:16:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037375; 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=3N/uiFKxEsEQzCtRRH9d0uAEMQpJRvyvOVOV/3++s2s=; b=eO81UfTNNbHo2f9zZsX1QAbcoq3c2UTuxjzccZJXoBEP6UK37c9KJvE/GieOgKMVp7h6jO pbH4eLsLjJl9p4v0NDk9HNijUVJTjzXcggMDnmBNVIAbBTYL96KW23ABvbZrc0Xl1Wvw+P SQ9yr/qcuQC0OhcJ5XHefF9xbS6NBm1/LJQtjQgPUKZT8W8uahTElq33Lv/JC752pwbKxk yCN7i8YEo1h3gELLSFfWLncwwYcfSiyIgV0EunOCk48/2OogkilFN3+yuaWM6tg50dHxyY NSWTREPki7Ox+lchwn9iP/Gd+YGz18/PX5Wk5ib3rkkRPtDIrUaWeJz3IVzBKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037375; 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=3N/uiFKxEsEQzCtRRH9d0uAEMQpJRvyvOVOV/3++s2s=; b=ti7p4cfrM4jf3/gCGyIBMju+PpbvBx6/OWP+peiyiHj50zVuVv1hV2xwsLaURFrBYUw3Oq R0g4qmMm4SO2dCvtphLQ9zsEqy3l4LztHczmT/HvaoHELGGR9ZGwFdcUJ6TMlBJLFYAEVv j4RuOKTwtqI95yoVUggE7MpSISPI8WaS+GU1WSo3LWP1F7sZksF3clwjN0DNKTYUh9gTtJ FBI7OGeBlS4em1iJXmWKPgelBr0Vpn8she94lo5P/lP5A40Bgg7GQ+Tt29xYue0s/V54Rt 0pIU5qmLXHReemcmn5tomXU/w+/Vn7IuLBZNRXSWP17xZ62vTUT6PUUCilbvcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751037375; a=rsa-sha256; cv=none; b=E9j2b9A6IWPZZ2PQCe5ikjZ9PITh2N5WoSmhef4LNyWiDjaYSU15Uq+Jku6CYEZiBLmuoO jG9W7PpWV/DI1yNUYCNmRMsgi0LCNEhuYTJDdKLFpYnXFlftleXVgD1hfzSMwFJR+ZQLPu ReXyDp5kOXmmHynelKMFK9q0cGnJ3G/EHDT2Hjr8ij/lumyD95uSEKm6FGxz3SlahDB7Uu H5rrBteX6R+8lDEGbA73xaY5MEWyXv6yNQb6VAJMg0woRefX4pQtspSQK3gzfregYySyIq i5kH98um1+nudmNc0Q8j6C20MDlz1ub0vgFf6BZTwPJop1YF/hLTOeFNgr2J7g== 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 4bTJzg2LQPztWv; Fri, 27 Jun 2025 15:16:15 +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 55RFGFo3049187; Fri, 27 Jun 2025 15:16:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55RFGFII049184; Fri, 27 Jun 2025 15:16:15 GMT (envelope-from git) Date: Fri, 27 Jun 2025 15:16:15 GMT Message-Id: <202506271516.55RFGFII049184@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: c31621c125ee - main - pfctl: fix memory leak 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: c31621c125ee4fa60e320781447864ebca5b3173 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c31621c125ee4fa60e320781447864ebca5b3173 commit c31621c125ee4fa60e320781447864ebca5b3173 Author: Kristof Provost AuthorDate: 2025-06-24 11:43:26 +0000 Commit: Kristof Provost CommitDate: 2025-06-27 14:55:17 +0000 pfctl: fix memory leak Be consistent in warn() and log_warn() usage when running out of memory. Next step, be correct *and* consistent. ok dennis@ tb@ benno@ schwarze@ Obtained from: OpenBSD, krw , 3c12ada049 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 8afef160b205..41f2d8dc70e7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7143,9 +7143,11 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - if (nfile) + if (nfile) { + warn("strdup"); free(nfile); - warn("malloc"); + } else + warn("calloc"); return (NULL); } if (TAILQ_FIRST(&files) == NULL && strcmp(nfile->name, "-") == 0) {