diff --git a/winpr/libwinpr/clipboard/clipboard.c b/winpr/libwinpr/clipboard/clipboard.c index ba4805af0..00c0d1698 100644 --- a/winpr/libwinpr/clipboard/clipboard.c +++ b/winpr/libwinpr/clipboard/clipboard.c @@ -83,9 +83,10 @@ static wClipboardFormat* ClipboardFindFormat(wClipboard* clipboard, UINT32 forma { for (index = 0; index < clipboard->numFormats; index++) { - if (formatId == clipboard->formats[index].formatId) + wClipboardFormat* cformat = &clipboard->formats[index]; + if (formatId == cformat->formatId) { - format = &clipboard->formats[index]; + format = cformat; break; } } @@ -94,12 +95,13 @@ static wClipboardFormat* ClipboardFindFormat(wClipboard* clipboard, UINT32 forma { for (index = 0; index < clipboard->numFormats; index++) { - if (!clipboard->formats[index].formatName) + wClipboardFormat* cformat = &clipboard->formats[index]; + if (!cformat->formatName) continue; - if (strcmp(name, clipboard->formats[index].formatName) == 0) + if (strcmp(name, cformat->formatName) == 0) { - format = &clipboard->formats[index]; + format = cformat; break; } } diff --git a/winpr/libwinpr/clipboard/synthetic.c b/winpr/libwinpr/clipboard/synthetic.c index 7c693c76b..db8af7113 100644 --- a/winpr/libwinpr/clipboard/synthetic.c +++ b/winpr/libwinpr/clipboard/synthetic.c @@ -234,7 +234,7 @@ static void* clipboard_synthesize_cf_dib(wClipboard* clipboard, UINT32 formatId, } else if (is_format_bitmap(clipboard, formatId)) { - const BITMAPFILEHEADER* pFileHeader; + const BITMAPFILEHEADER* pFileHeader = NULL; if (SrcSize < (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER))) return NULL;