From 8bdc2f1edf83555df52a6439320a87975ab84788 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 14 Nov 2023 20:06:55 +0000 Subject: [PATCH] ipc: Fix visibility mask leak --- src/xrt/ipc/server/ipc_server_handler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index 017627aaa..27548cf25 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -1588,16 +1588,18 @@ ipc_handle_device_get_visibility_mask(volatile struct ipc_client_state *ics, xret = ipc_send(imc, &reply, sizeof(reply)); if (xret != XRT_SUCCESS) { IPC_ERROR(s, "Failed to send reply"); - return xret; + goto out_free; } xret = ipc_send(imc, mask, reply.mask_size); if (xret != XRT_SUCCESS) { IPC_ERROR(s, "Failed to send mask"); - return xret; + goto out_free; } - return XRT_SUCCESS; +out_free: + free(mask); + return xret; } xrt_result_t