Removed unnecessary allocation

This commit is contained in:
Armin Novak
2021-06-02 15:36:43 +02:00
committed by akallabeth
parent 0c0c97d80f
commit 140dffade6

View File

@@ -260,7 +260,6 @@ static void wf_sizing(wfContext* wfc, WPARAM wParam, LPARAM lParam)
static void wf_send_resize(wfContext* wfc) static void wf_send_resize(wfContext* wfc)
{ {
RECT windowRect; RECT windowRect;
DISPLAY_CONTROL_MONITOR_LAYOUT* layout;
int targetWidth = wfc->client_width; int targetWidth = wfc->client_width;
int targetHeight = wfc->client_height; int targetHeight = wfc->client_height;
rdpSettings* settings = wfc->context.settings; rdpSettings* settings = wfc->context.settings;
@@ -278,22 +277,23 @@ static void wf_send_resize(wfContext* wfc)
if (settings->SmartSizingWidth != targetWidth || if (settings->SmartSizingWidth != targetWidth ||
settings->SmartSizingHeight != targetHeight) settings->SmartSizingHeight != targetHeight)
{ {
layout = calloc(1, sizeof(DISPLAY_CONTROL_MONITOR_LAYOUT)); DISPLAY_CONTROL_MONITOR_LAYOUT layout = { 0 };
layout->Flags = DISPLAY_CONTROL_MONITOR_PRIMARY;
layout->Top = layout->Left = 0; layout.Flags = DISPLAY_CONTROL_MONITOR_PRIMARY;
layout->Width = targetWidth; layout.Top = layout.Left = 0;
layout->Height = targetHeight; layout.Width = targetWidth;
layout->Orientation = settings->DesktopOrientation; layout.Height = targetHeight;
layout->DesktopScaleFactor = settings->DesktopScaleFactor; layout.Orientation = settings->DesktopOrientation;
layout->DeviceScaleFactor = settings->DeviceScaleFactor; layout.DesktopScaleFactor = settings->DesktopScaleFactor;
layout->PhysicalWidth = targetWidth; layout.DeviceScaleFactor = settings->DeviceScaleFactor;
layout->PhysicalHeight = targetHeight; layout.PhysicalWidth = targetWidth;
layout.PhysicalHeight = targetHeight;
if (IFCALLRESULT(CHANNEL_RC_OK, wfc->disp->SendMonitorLayout, wfc->disp, 1, if (IFCALLRESULT(CHANNEL_RC_OK, wfc->disp->SendMonitorLayout, wfc->disp, 1,
layout) != CHANNEL_RC_OK) &layout) != CHANNEL_RC_OK)
{ {
WLog_ERR("", "SendMonitorLayout failed."); WLog_ERR("", "SendMonitorLayout failed.");
} }
free(layout);
settings->SmartSizingWidth = targetWidth; settings->SmartSizingWidth = targetWidth;
settings->SmartSizingHeight = targetHeight; settings->SmartSizingHeight = targetHeight;
} }