git: 27331c63bc80 - stable/15 - sockstat: fix the -j option with piped output after libxo integration
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Sep 2025 19:43:56 UTC
The branch stable/15 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=27331c63bc806eaec70b34f81bcb4caac8a0e0f4 commit 27331c63bc806eaec70b34f81bcb4caac8a0e0f4 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2025-09-09 16:29:34 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2025-09-19 19:41:17 +0000 sockstat: fix the -j option with piped output after libxo integration The legacy code handling -j in display() was causing xo_finish() to be skipped. It has also been causing a memory leak since 0726c6574f8 (sockstat: Add automatic column sizing and remove -w option) Fixes: 7b35b4d1963 (sockstat: add libxo support) Reported by: glebius Reviewed by: glebius Sponsored by: ConnectWise Pull Request: https://github.com/freebsd/freebsd-src/pull/1842 (cherry picked from commit 9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd) --- usr.bin/sockstat/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c index b5e0248b743a..2e75e4966d80 100644 --- a/usr.bin/sockstat/main.c +++ b/usr.bin/sockstat/main.c @@ -1612,7 +1612,7 @@ display(void) } } if (opt_j >= 0) - return; + goto out; SLIST_FOREACH(s, &nosocks, socket_list) { if (!check_ports(s)) continue; @@ -1637,6 +1637,7 @@ display(void) display_sock(s, &cw, buf, bufsize); xo_close_instance("socket"); } +out: xo_close_list("socket"); xo_close_container("sockstat"); if (xo_finish() < 0)