From nobody Fri Jun 27 15:16:16 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 4bTJzh6sDTz5yvJj; Fri, 27 Jun 2025 15:16:16 +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 4bTJzh42hbz3Ydl; Fri, 27 Jun 2025 15:16:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037376; 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=k5ARhKdBpgmFXcudo2YFd8tZW0drgDyqmMdLmddM/gg=; b=hL7oELqJipBC2RXJAqQo3cQhPqPkL/WzG3UNvvzbN6JEr3qMETNT3vc9z7pODMJTLw3tym yiMzxwo4yLACN55VqWmtJ/DA5M/+ShnJ24BWIpvgqGqIRjfSb4z0QlPB2fx41ErsIKnPl1 WEzsynGpNVV0bPDzlBwyMIwFLT5+YpJHZF8EyFOiftx2bCjlwSwlzmQKN92bNe71RkOGCt pmn3niBfSmYHD76FUzkxiU3Re3SIfhPTm0vmvAz4hyY6qPcVqUDj0VRchZVfqw9OTcjr5P E23InftBVuuuPBWlPDvpDNzQbOBvuZ7uCZZfB2O1+l2wEEmml6wDbx5Rg3KRPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751037376; 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=k5ARhKdBpgmFXcudo2YFd8tZW0drgDyqmMdLmddM/gg=; b=bF2j8P117th6jVKUMSp1b+XG6dFV5Sf0KIedvMr9VlS/YsBdsVc9MF28mArUokq4YHB45J X4F7B8XG3p+VK0tkk2BU22QqrZRhRUCN04fpL8uRljnpXhtbC0/uT4Fd0JqVKsMThnBfjs 5KDE0Zad0fDQKWPwqtNnHXya/oBwqC/R5G3PbEFQ4j4wRxTU7e3dG/GXA1GkxNWT7YWJnB JCpVUFgIB/lWODvOhbDVDc1k4uIY/HH7XlfJnX/CKaTZkP1OR2cvW1QpZa9x30d1mXhnl+ fAoWtbtnyoPECjJS5j0umGzuBBrl4yQW+GnfRgA1QiQtDBj2Dz1k+6t++fMNSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751037376; a=rsa-sha256; cv=none; b=SL7b3famMHZ9xnqBxIBTtG/c6QXgi/3WAQnGBsJOPTLdn9TFvPEBGHDYFHAsZiklr/6J2d 6vBdNMKoJi9FfJHmi/PhTzsaV2WPCtybHstqzs8yxpfeGZlhJxhtarWgEIe8rEI2u/Z195 YF1JX+QOq8PuNaW4tz5Ja41adH675+e9RNMVAh/iKX3ktyxzLC4AkRBtPUP3+gZrweaMg3 kiq9Nc9L0LTYOQ/yGSCzxyM8f9zv+JAyYtIxdDvDa8IUBnn8EanlkqlXuSGFCAfaTf1FPz YtF8lPMDi7T/H+M+bJE3dMLoUMyQ8n/zrdWVQ/+v3yj6UENwdPIltHL4yRyFtg== 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 4bTJzh3bfczsgd; Fri, 27 Jun 2025 15:16:16 +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 55RFGGhk049219; Fri, 27 Jun 2025 15:16:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55RFGG7K049216; Fri, 27 Jun 2025 15:16:16 GMT (envelope-from git) Date: Fri, 27 Jun 2025 15:16:16 GMT Message-Id: <202506271516.55RFGG7K049216@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: 6ccd82f8deb5 - main - pfctl: clean up allocation warnings 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: 6ccd82f8deb5cff3e5c2ad4df594c60470062c08 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6ccd82f8deb5cff3e5c2ad4df594c60470062c08 commit 6ccd82f8deb5cff3e5c2ad4df594c60470062c08 Author: Kristof Provost AuthorDate: 2025-06-24 11:51:35 +0000 Commit: Kristof Provost CommitDate: 2025-06-27 14:55:17 +0000 pfctl: clean up allocation warnings No need to mention which memory allocation entry point failed (malloc, calloc or strdup), we just need to log that we ran out of memory in a particular function. Recommended by florian@ and deraadt@ ok benno@ henning@ tb@ Obtained from: OpenBSD, krw , 6a3d55f939 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 41f2d8dc70e7..39d5ba317653 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7143,23 +7143,21 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - if (nfile) { - warn("strdup"); + warn("%s", __func__); + if (nfile) free(nfile); - } else - warn("calloc"); return (NULL); } if (TAILQ_FIRST(&files) == NULL && strcmp(nfile->name, "-") == 0) { nfile->stream = stdin; free(nfile->name); if ((nfile->name = strdup("stdin")) == NULL) { - warn("strdup"); + warn("%s", __func__); free(nfile); return (NULL); } } else if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { - warn("%s", nfile->name); + warn("%s: %s", __func__, nfile->name); free(nfile->name); free(nfile); return (NULL); @@ -7174,7 +7172,7 @@ pushfile(const char *name, int secret) nfile->ungetsize = 16; nfile->ungetbuf = malloc(nfile->ungetsize); if (nfile->ungetbuf == NULL) { - warn("malloc"); + warn("%s", __func__); fclose(nfile->stream); free(nfile->name); free(nfile);