From 865ee84ab574c336117762b6c88919436de37250 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 17 Aug 2018 12:51:19 +0200 Subject: [PATCH] channels/rail: Fix leak found by covscan leaked_storage: Variable "s" going out of scope leaks the storage it points to. --- channels/rail/client/rail_orders.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/channels/rail/client/rail_orders.c b/channels/rail/client/rail_orders.c index 4efec01..d10b8ee 100644 --- a/channels/rail/client/rail_orders.c +++ b/channels/rail/client/rail_orders.c @@ -910,15 +910,16 @@ UINT rail_send_client_exec_order(railPlugin* rail, RAIL_EXEC_ORDER* exec) if ((error = rail_write_client_exec_order(s, exec))) { WLog_ERR(TAG, "rail_write_client_exec_order failed with error %"PRIu32"!", error); - return error; + goto out; } if ((error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_EXEC))) { WLog_ERR(TAG, "rail_send_pdu failed with error %"PRIu32"!", error); - return error; + goto out; } +out: Stream_Free(s, TRUE); return error; } @@ -972,15 +973,16 @@ static UINT rail_send_client_sysparam_order(railPlugin* rail, RAIL_SYSPARAM_ORDE if ((error = rail_write_client_sysparam_order(s, sysparam))) { WLog_ERR(TAG, "rail_write_client_sysparam_order failed with error %"PRIu32"!", error); - return error; + goto out; } if ((error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_SYSPARAM))) { WLog_ERR(TAG, "rail_send_pdu failed with error %"PRIu32"!", error); - return error; + goto out; } +out: Stream_Free(s, TRUE); return error; } -- 2.7.4