diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 23:24:56 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 23:24:56 +0000 |
commit | 3e286c3c6226d112d387336a745fe6483e7b9fe5 (patch) | |
tree | e9da847cb9777f1a45c16760d10999b86516cb3a /ppapi/proxy/gamepad_resource.cc | |
parent | a716cc122ecbaafc3ea0f130df31517bcc191d41 (diff) | |
download | chromium_src-3e286c3c6226d112d387336a745fe6483e7b9fe5.zip chromium_src-3e286c3c6226d112d387336a745fe6483e7b9fe5.tar.gz chromium_src-3e286c3c6226d112d387336a745fe6483e7b9fe5.tar.bz2 |
Avoid leaking SerializedHandles.
This CL automatically closes SerializedHandles at the receiving side of ResourceMessageParams (the host side for ResourceMessageCallParams; the plugin side for ResourceMessageReplyParams), if they are not taken by message handlers.
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/11312017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/gamepad_resource.cc')
-rw-r--r-- | ppapi/proxy/gamepad_resource.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ppapi/proxy/gamepad_resource.cc b/ppapi/proxy/gamepad_resource.cc index 3055513..8a49437 100644 --- a/ppapi/proxy/gamepad_resource.cc +++ b/ppapi/proxy/gamepad_resource.cc @@ -98,8 +98,8 @@ void GamepadResource::Sample(PP_GamepadsSampleData* data) { void GamepadResource::OnPluginMsgSendMemory( const ResourceMessageReplyParams& params) { // On failure, the handle will be null and the CHECK below will be tripped. - base::SharedMemoryHandle handle; - params.GetSharedMemoryHandleAtIndex(0, &handle); + base::SharedMemoryHandle handle = base::SharedMemory::NULLHandle(); + params.TakeSharedMemoryHandleAtIndex(0, &handle); shared_memory_.reset(new base::SharedMemory(handle, true)); CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer))); |