From nobody Tue Jan 14 15:26:19 2025 X-Original-To: dev-commits-src-all@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 4YXXyz5KfHz5kp2W; Tue, 14 Jan 2025 15:26:19 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXXyz1sXNz3p3g; Tue, 14 Jan 2025 15:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868379; 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=ah4XxiJDF4QO+4fAjaOibkWajUMuAqLvmfSQdjGYNyo=; b=e+Bf9oRy2TD9/0Dm1IhZ1QucUttXhSqmOWsZY9KqXmr5PdT1J6S+J8HTs9gtSGJCRcHm9o vxQ7orJPcR77jBUHFWQlr2uxJpTmV2VXcpe296Cay9Kmq8ljCF5sYu5qgr8n2bnj2598AQ ZfMSCndAZSJvTtcu1EvGGqK3pczY4l5An6ozZ9H+Noj81q/E0PPoOAN51upK9MXU4t18sN cHD1OLZc3uf6Ou64mOEcqlR/fTs8QJGlY6uk9B3Sh9bLfPng7FxBQ9NPaxliV+Ifugy2ni usPWvjCEWclbHbckMJ0OqkcJB712TfGn348SRhHLzEilN6R9KG64ydzdpC+gTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868379; 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=ah4XxiJDF4QO+4fAjaOibkWajUMuAqLvmfSQdjGYNyo=; b=hgS6VzqQ3HuGAOl6vH3T4bDrZqu8MjbO7vxKr2OT37A7lc9ypcFNy3ZTjjRaeZ3INp6gmp Vo9gXeXwwGBk/+g1EfafwPTyCdpitjagtd7NvS0hv4ARrJPiHSNAi3veGKeJ3kBeSv7SUP +YKAD0MUpq1i6cF7+0q4g0JFyCtGPX6/2YjbeWx0hk0L/cnQSsLoW1QN1+DMausIViqI2E 7kof9Hoaq/NP7EPqxlkzoNskYa9mhJxrkRgHzMwJLq+79o+VzrPisDnDw8qCZG6Cyik0y8 eUQ5rjKr7IWvc8GT+7jy6Ng5kOxlCY/Ou9Cu+1wymHSrMIKeQqQXJqbmWAV9vQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736868379; a=rsa-sha256; cv=none; b=PyCt4QOFmDktFV85y8VYwIKIPb7S+dnX4Uxu9LWBxrztMANtYpWMoFH1KlexlovpGf/em2 edIzOdraScLyBCmutbbUIaIshY8A4C4HBAlFpEudug7ucGEifASajkfJhd/JPUVSSPK3NH qfS5FcCHes9GMruwdzZ2NMkenxtwHP8XwfXRQf871l7Kptxw3w4jhytOcNlQYb+YqM24n8 hTM/3OI3HBZPckUFnlVGnzIzqZiRaXoi4CiCDdU/6833QXBQzDMdyXYhnQmHG0wBng9pN6 MtpEvbwcgRQ53sUc/tq2hfvcMV6QtZ8RCxUSYMI5v9m6B5nIHwqynhziEu5B+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YXXyz1KyRz1LY8; Tue, 14 Jan 2025 15:26:19 +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 50EFQJdj090831; Tue, 14 Jan 2025 15:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFQJNc090828; Tue, 14 Jan 2025 15:26:19 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:26:19 GMT Message-Id: <202501141526.50EFQJNc090828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e6c9c463384d - main - ls: Release resources before returning from traverse() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6c9c463384d11a44af3e5f2cc947fb69f3a1968 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6c9c463384d11a44af3e5f2cc947fb69f3a1968 commit e6c9c463384d11a44af3e5f2cc947fb69f3a1968 Author: Mark Johnston AuthorDate: 2025-01-14 14:20:26 +0000 Commit: Mark Johnston CommitDate: 2025-01-14 14:20:26 +0000 ls: Release resources before returning from traverse() PR: 278476 MFC after: 2 weeks Reported by: valgrind --- bin/ls/ls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index a285838e2ee1..048cfc9293e6 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -643,8 +643,10 @@ traverse(int argc, char *argv[], int options) chp = fts_children(ftsp, 0); if (chp != NULL) display(NULL, chp, options); - if (f_listdir) + if (f_listdir) { + fts_close(ftsp); return; + } /* * If not recursing down this tree and don't need stat info, just get @@ -693,6 +695,7 @@ traverse(int argc, char *argv[], int options) } if (errno) err(1, "fts_read"); + fts_close(ftsp); } /*