#6037 Fix potential memory leak if SetClipboardData fails

This commit is contained in:
Andrew Nelless 2017-05-12 01:07:57 +01:00
parent 7deb5f04f3
commit 823868f767
1 changed files with 5 additions and 1 deletions

View File

@ -88,7 +88,11 @@ MSWindowsClipboard::empty()
// mark clipboard as being owned by synergy // mark clipboard as being owned by synergy
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1); HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1);
SetClipboardData(getOwnershipFormat(), data); if (NULL == SetClipboardData(getOwnershipFormat(), data)) {
LOG((CLOG_DEBUG "failed to set clipboard data"));
GlobalFree(data);
return false;
}
return true; return true;
} }