Commit a6e8a0af authored by zhaoqin@google.com's avatar zhaoqin@google.com

fixed issue 349227: Uninit error due to DuplicateHandle failure - add check on...

fixed issue 349227: Uninit error due to DuplicateHandle failure - add check on DuplicateHandle and assign duped to be NULL on failure
BUG=349227
R=sky@chromium.org, wfh@chromium.org, jschuh@chromium.org
TEST=manual+drmemory

Review URL: https://codereview.chromium.org/181013016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255955 0039d316-1c4b-4281-b951-d872f2087c98
parent f4b0da13
......@@ -143,9 +143,13 @@ bool MockRenderProcessHost::Send(IPC::Message* msg) {
TransportDIB* MockRenderProcessHost::MapTransportDIB(TransportDIB::Id dib_id) {
#if defined(OS_WIN)
HANDLE duped;
DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(),
&duped, 0, TRUE, DUPLICATE_SAME_ACCESS);
// NULL should be used here instead of INVALID_HANDLE_VALUE (or pseudo-handle)
// except for when dealing with the small number of Win16-derived APIs
// that require INVALID_HANDLE_VALUE (e.g. CreateFile and friends).
HANDLE duped = NULL;
if (!DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(),
&duped, 0, TRUE, DUPLICATE_SAME_ACCESS))
duped = NULL;
return TransportDIB::Map(duped);
#elif defined(TOOLKIT_GTK)
return TransportDIB::Map(dib_id.shmkey);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment