When we can't write both the FDs back to the guest's memory, close them so we don't leak them.
Signed-off-by: Warner Losh <[email protected]> --- bsd-user/freebsd/os-file.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsd-user/freebsd/os-file.h b/bsd-user/freebsd/os-file.h index bc31064a50..aa8d8bda74 100644 --- a/bsd-user/freebsd/os-file.h +++ b/bsd-user/freebsd/os-file.h @@ -34,6 +34,8 @@ static abi_long do_bsd_pipe2(CPUArchState *env, abi_ulong pipedes, int flags) */ if (put_user_s32(host_pipe[0], pipedes) || put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0]))) { + close(host_pipe[0]); + close(host_pipe[1]); return -TARGET_EFAULT; } return 0; -- 2.52.0
