channels/cliprdr/client/cliprdr_main.c: fix resource leak

found by coverity

655        if (Stream_Write_UTF16_String_From_UTF8(s, tmpDirCharLen - 1, tempDirectory->szTempDir,
656                                                ARRAYSIZE(tempDirectory->szTempDir), TRUE) < 0)

CID 424748: (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable s going out of scope leaks the storage it points to.
657                return ERROR_INTERNAL_ERROR;
658        /* Path must be 260 UTF16 characters with '\0' termination.
659         * ensure this here */
This commit is contained in:
Ilya Shipitsin 2024-04-06 23:03:57 +02:00 committed by akallabeth
parent c7954ad0f3
commit 822537be0e
1 changed files with 3 additions and 0 deletions

View File

@ -654,7 +654,10 @@ static UINT cliprdr_temp_directory(CliprdrClientContext* context,
if (Stream_Write_UTF16_String_From_UTF8(s, tmpDirCharLen - 1, tempDirectory->szTempDir, if (Stream_Write_UTF16_String_From_UTF8(s, tmpDirCharLen - 1, tempDirectory->szTempDir,
ARRAYSIZE(tempDirectory->szTempDir), TRUE) < 0) ARRAYSIZE(tempDirectory->szTempDir), TRUE) < 0)
{
Stream_Free(s, TRUE);
return ERROR_INTERNAL_ERROR; return ERROR_INTERNAL_ERROR;
}
/* Path must be 260 UTF16 characters with '\0' termination. /* Path must be 260 UTF16 characters with '\0' termination.
* ensure this here */ * ensure this here */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);