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 0726c6574f
(sockstat: Add automatic column sizing and remove -w option)

Fixes:		7b35b4d196 (sockstat: add libxo support)
MFC after:	1 week
Reported by:	glebius
Reviewed by:	glebius
Sponsored by:	ConnectWise
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1842
This commit is contained in:
Alan Somers
2025-09-09 10:29:34 -06:00
parent faf7e99375
commit 9bfbc6826f
+2 -1
View File
@@ -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)