From a78fd8a07e93f4e64e99dd822e814d3f44b3d308 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 7 Sep 2016 20:51:49 +0200 Subject: [PATCH] user32: Only call GlobalUnlock when GlobalLock was successful. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- dlls/user32/clipboard.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 72f73345dc3..f6f073edce6 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -89,8 +89,11 @@ static LCID get_clipboard_locale(void) if ((data = GetClipboardData( CF_LOCALE ))) { LCID *ptr = GlobalLock( data ); - if (ptr && GlobalSize( data ) >= sizeof(*ptr)) lcid = *ptr; - GlobalUnlock( data ); + if (ptr) + { + if (GlobalSize( data ) >= sizeof(*ptr)) lcid = *ptr; + GlobalUnlock( data ); + } } return lcid; }