mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-08 14:41:57 +08:00
#6037 Fix potential memory leak if SetClipboardData fails
This commit is contained in:
@@ -88,7 +88,11 @@ MSWindowsClipboard::empty()
|
||||
|
||||
// mark clipboard as being owned by synergy
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user