diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index ef4030e49d98..71ff1998c92c 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -266,8 +266,10 @@ main(argc, argv) if (header || wcmd == 0) { pr_header(&now, nusers); - if (wcmd == 0) + if (wcmd == 0) { + (void)kvm_close(kd); exit(0); + } #define HEADER_USER "USER" #define HEADER_TTY "TTY" @@ -417,6 +419,7 @@ main(argc, argv) longidle = pr_idle(ep->idle); (void)printf("%.*s\n", argwidth - longidle, ep->args); } + (void)kvm_close(kd); exit(0); }