mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[client,x11] fix double free in case of invalid pointer
This commit is contained in:
@@ -289,7 +289,6 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
|
||||
#ifdef WITH_XCURSOR
|
||||
UINT32 CursorFormat = 0;
|
||||
size_t size = 0;
|
||||
xfContext* xfc = (xfContext*)context;
|
||||
xfPointer* xpointer = (xfPointer*)pointer;
|
||||
|
||||
@@ -304,19 +303,18 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
xpointer->nCursors = 0;
|
||||
xpointer->mCursors = 0;
|
||||
|
||||
size = 1ull * pointer->height * pointer->width * FreeRDPGetBytesPerPixel(CursorFormat);
|
||||
const size_t size =
|
||||
1ull * pointer->height * pointer->width * FreeRDPGetBytesPerPixel(CursorFormat);
|
||||
|
||||
if (!(xpointer->cursorPixels = (XcursorPixel*)winpr_aligned_malloc(size, 16)))
|
||||
xpointer->cursorPixels = (XcursorPixel*)winpr_aligned_malloc(size, 16);
|
||||
if (!xpointer->cursorPixels)
|
||||
goto fail;
|
||||
|
||||
if (!freerdp_image_copy_from_pointer_data(
|
||||
(BYTE*)xpointer->cursorPixels, CursorFormat, 0, 0, 0, pointer->width, pointer->height,
|
||||
pointer->xorMaskData, pointer->lengthXorMask, pointer->andMaskData,
|
||||
pointer->lengthAndMask, pointer->xorBpp, &context->gdi->palette))
|
||||
{
|
||||
winpr_aligned_free(xpointer->cursorPixels);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user