aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-06-15 04:31:03 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-15 12:57:25 +0000
commit281e350942b26b054ba5bc820c6aae4ae0e03a38 (patch)
tree7fd32845cbf4967cae08c3e41d9dd276690b2be6
parent96759ab67a42226679675e24e35549aea2aa49e0 (diff)
ntsync(9): free wait state on error from copyin of the object's array
Sponsored by: The FreeBSD Foundation MFC after: 3 days
-rw-r--r--sys/dev/ntsync/ntsync.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c
index 2d3054e0a4ee..5fba9775be0e 100644
--- a/sys/dev/ntsync/ntsync.c
+++ b/sys/dev/ntsync/ntsync.c
@@ -1210,7 +1210,7 @@ ntsync_wait_state_get(struct ntsync_wait_args *nwa, u_long cmd,
error = copyin((void *)(uintptr_t)nwa->objs, &state->fds[0],
nwa->count * sizeof(state->fds[0]));
if (error != 0)
- return (error);
+ goto error_ret;
i = 0;
if (nwa->alert != 0) {
@@ -1296,6 +1296,8 @@ error_out:
fdrop(state->fps[j], td);
if (state->fp_alert != NULL)
fdrop(state->fp_alert, td);
+error_ret:
+ free(state, M_NTSYNC);
return (error);
}