From nobody Mon Jun 30 15:00:48 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 4bW8VT37B7z60YvK; Mon, 30 Jun 2025 15:00:49 +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 4bW8VS6kPGz3DBN; Mon, 30 Jun 2025 15:00:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295649; 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=zsywpc5tkDBxXbeLKQN6HIM6dM3P9cPIvDnDDTlrWfE=; b=ISztBWhpj2v6I+ViFZqaZQtrr2/gUCsh0gL4FbtaZJt3ZWtEWhEyW95mf5zTBb+6WRaeVZ 4NFmtFcO8//47FmHNIQY/gpWTGA/LZIZVzyup4g4fFuA1DGoS30Jp47ABB1cZaYDDduj42 E/D++5Wm0VAo/1qlDc7M11ru147lS581aN4xbJ8uMuNP1u92GKLDucR0BRtYYSyyybwAUX zxjyK1gxePWNeCOfKUxCfW9srtyGYnZujI4lI92HiEoVgrlnUCwiOLhGLuuR0WCCF4NBYP kPuNe/7fBrMaZ4P100qUOv2VUTLE0/HIaYXIq08Rz4RXjPE3sQgCXtqE7SGNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295649; 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=zsywpc5tkDBxXbeLKQN6HIM6dM3P9cPIvDnDDTlrWfE=; b=dXaxcOj3qEjn1GX909xYCMc5ryXhzuMSQzRQ+OIaTeFsBffNbEGW94+UaDFxKqqKuxbgO7 LS42ItkHw6/Jkwocxt9sFpdA198ooCjR+mqVLAPbv02kDs3/EkJqjVVAWTMxhuTouSMDFl ZhNhI1yfDxuYkM6QRmQlnN9iHXqVPYOBooE3GLUV3CumNBjQucmCuEABISTz/sYMI7+Dov huEziG2PR/OlMhWnl5+DSuypNMPZkqch9GjCVBIvLuJdE3/WEMcG3l5myx1fhUHda+0Kit ZGWxFMaGjBeO3gysx53NIVqT1/I+mqbcbPpfbBEJuYfa1d/h4JF/yt5WNkQqBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295649; a=rsa-sha256; cv=none; b=YoPZLz7utRgZ3+aFB7lUeIqqAeO9QVd0b3f1x4T0UpG6ZOvGijkSoLERPUlz//6nlYH0q0 94U7ooqC3nmyS/YIDsOUt0dr9bWqcZS1WMscSFi+wWLrY2ChxZDPewfphQLKt99zlzJ95Z up5BhABcJiKqsck+3jP15ls8ie9qBGhogIST2O7nxwe2/QfT2aznWHoEbLT4Kc48xx5eCk EBiqGW6o0l0KrXRJaxfF/hYvz6ojkuwC8Enq2BstJzCXsmLDFBO0dD7yZ7i9PuXGgiAMDw 8hgrZm2Oapw1fQjoH9RXvAPNecc02b31h3XjbMis1kt4LTcbB+Aor8a/gKBaUw== 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 4bW8VS63F1z17k5; Mon, 30 Jun 2025 15:00:48 +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 55UF0mP4047440; Mon, 30 Jun 2025 15:00:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0mF5047437; Mon, 30 Jun 2025 15:00:48 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:48 GMT Message-Id: <202506301500.55UF0mF5047437@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: b728aaa12cbe - main - pfctl: Simplify getaddrinfo() error handling 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: b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 commit b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 Author: Kristof Provost AuthorDate: 2025-06-27 09:27:14 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:27 +0000 pfctl: Simplify getaddrinfo() error handling `error' is not used so drop it and jump to the end. OK sashan Obtained from: OpenBSD, kn , da7f49d74e Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 92debd6227e7..c475eab0de91 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1968,8 +1968,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) { struct addrinfo hints, *res0, *res; struct node_host *n, *h = NULL; - int error, noalias = 0; - int got4 = 0, got6 = 0; + int noalias = 0, got4 = 0, got6 = 0; char *p, *ps; if ((ps = strdup(s)) == NULL) @@ -1983,11 +1982,8 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) hints.ai_socktype = SOCK_STREAM; /* DUMMY */ if (numeric) hints.ai_flags = AI_NUMERICHOST; - error = getaddrinfo(ps, NULL, &hints, &res0); - if (error) { - free(ps); - return (h); - } + if (getaddrinfo(ps, NULL, &hints, &res0) != 0) + goto error; for (res = res0; res; res = res->ai_next) { if (res->ai_family != AF_INET && @@ -2035,6 +2031,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) } } freeaddrinfo(res0); +error: free(ps); return (h);