channels/urbdrc/client/data_transfer.c: fix resource leak

found by coverity

705        if (transferDir == USBD_TRANSFER_DIRECTION_OUT)
706        {
      18. Condition !Stream_CheckAndLogRequiredLengthEx("com.freerdp.channels.urbdrc.client" /* "com.freerdp.channels.urbdrc.client" */, 3, s, OutputBufferSize, 1, "%s(%s:%zu)" /* "%s(%s:%zu)" */, <anonymous>, "/home/runner/work/FreeRDP/FreeRDP/channels/urbdrc/client/data_transfer.c", 707UL /* (size_t)707 */), taking true branch.
707                if (!Stream_CheckAndLogRequiredLength(TAG, s, OutputBufferSize))

CID 424733: (#1 of 1): Resource leak (RESOURCE_LEAK)
19. leaked_storage: Variable out going out of scope leaks the storage it points to.
708                        return ERROR_INVALID_DATA;
709                Stream_Copy(s, out, OutputBufferSize);
710        }
This commit is contained in:
Ilya Shipitsin 2024-04-06 22:57:39 +02:00 committed by akallabeth
parent b3d8434578
commit c7954ad0f3

View File

@ -705,7 +705,10 @@ static UINT urb_control_transfer(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callb
if (transferDir == USBD_TRANSFER_DIRECTION_OUT)
{
if (!Stream_CheckAndLogRequiredLength(TAG, s, OutputBufferSize))
{
Stream_Free(out, TRUE);
return ERROR_INVALID_DATA;
}
Stream_Copy(s, out, OutputBufferSize);
}