summaryrefslogtreecommitdiff
path: root/chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc')
-rw-r--r--chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc b/chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc
index c937b760daa..69203f034d8 100644
--- a/chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc
+++ b/chromium/ui/base/dragdrop/os_exchange_data_provider_win.cc
@@ -859,9 +859,10 @@ ULONG DataObjectImpl::Release() {
static STGMEDIUM* GetStorageForBytes(const void* data, size_t bytes) {
HANDLE handle = GlobalAlloc(GPTR, static_cast<int>(bytes));
- base::win::ScopedHGlobal<uint8> scoped(handle);
- size_t allocated = static_cast<size_t>(GlobalSize(handle));
- memcpy(scoped.get(), data, allocated);
+ if (handle) {
+ base::win::ScopedHGlobal<uint8> scoped(handle);
+ memcpy(scoped.get(), data, bytes);
+ }
STGMEDIUM* storage = new STGMEDIUM;
storage->hGlobal = handle;