From 140dffade691dbb0a43b52c1be5cb87d7ff13226 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 2 Jun 2021 15:36:43 +0200 Subject: [PATCH] Removed unnecessary allocation --- client/Windows/wf_event.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/client/Windows/wf_event.c b/client/Windows/wf_event.c index 86fd07563..c35c2248c 100644 --- a/client/Windows/wf_event.c +++ b/client/Windows/wf_event.c @@ -260,7 +260,6 @@ static void wf_sizing(wfContext* wfc, WPARAM wParam, LPARAM lParam) static void wf_send_resize(wfContext* wfc) { RECT windowRect; - DISPLAY_CONTROL_MONITOR_LAYOUT* layout; int targetWidth = wfc->client_width; int targetHeight = wfc->client_height; rdpSettings* settings = wfc->context.settings; @@ -278,22 +277,23 @@ static void wf_send_resize(wfContext* wfc) if (settings->SmartSizingWidth != targetWidth || settings->SmartSizingHeight != targetHeight) { - layout = calloc(1, sizeof(DISPLAY_CONTROL_MONITOR_LAYOUT)); - layout->Flags = DISPLAY_CONTROL_MONITOR_PRIMARY; - layout->Top = layout->Left = 0; - layout->Width = targetWidth; - layout->Height = targetHeight; - layout->Orientation = settings->DesktopOrientation; - layout->DesktopScaleFactor = settings->DesktopScaleFactor; - layout->DeviceScaleFactor = settings->DeviceScaleFactor; - layout->PhysicalWidth = targetWidth; - layout->PhysicalHeight = targetHeight; + DISPLAY_CONTROL_MONITOR_LAYOUT layout = { 0 }; + + layout.Flags = DISPLAY_CONTROL_MONITOR_PRIMARY; + layout.Top = layout.Left = 0; + layout.Width = targetWidth; + layout.Height = targetHeight; + layout.Orientation = settings->DesktopOrientation; + layout.DesktopScaleFactor = settings->DesktopScaleFactor; + layout.DeviceScaleFactor = settings->DeviceScaleFactor; + layout.PhysicalWidth = targetWidth; + layout.PhysicalHeight = targetHeight; + if (IFCALLRESULT(CHANNEL_RC_OK, wfc->disp->SendMonitorLayout, wfc->disp, 1, - layout) != CHANNEL_RC_OK) + &layout) != CHANNEL_RC_OK) { WLog_ERR("", "SendMonitorLayout failed."); } - free(layout); settings->SmartSizingWidth = targetWidth; settings->SmartSizingHeight = targetHeight; }