Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3537)

Unified Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 18474005: Fix handle leak on broker error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/nacl_host/nacl_process_host.cc
===================================================================
--- chrome/browser/nacl_host/nacl_process_host.cc (revision 211047)
+++ chrome/browser/nacl_host/nacl_process_host.cc (working copy)
@@ -506,6 +506,20 @@
bool NaClProcessHost::ReplyToRenderer(
const IPC::ChannelHandle& channel_handle) {
+#if defined(OS_WIN)
+ // If we are on 64-bit Windows, the NaCl process's sandbox is
+ // managed by a different process from the renderer's sandbox. We
+ // need to inform the renderer's sandbox about the NaCl process so
+ // that the renderer can send handles to the NaCl process using
+ // BrokerDuplicateHandle().
+ if (RunningOnWOW64()) {
+ if (!content::BrokerAddTargetPeer(process_->GetData().handle)) {
+ LOG(ERROR) << "Failed to add NaCl process PID";
+ return false;
+ }
+ }
+#endif
+
nacl::FileDescriptor handle_for_renderer;
#if defined(OS_WIN)
// Copy the handle into the renderer process.
@@ -532,20 +546,6 @@
handle_for_renderer = imc_handle;
#endif
-#if defined(OS_WIN)
- // If we are on 64-bit Windows, the NaCl process's sandbox is
- // managed by a different process from the renderer's sandbox. We
- // need to inform the renderer's sandbox about the NaCl process so
- // that the renderer can send handles to the NaCl process using
- // BrokerDuplicateHandle().
- if (RunningOnWOW64()) {
- if (!content::BrokerAddTargetPeer(process_->GetData().handle)) {
- LOG(ERROR) << "Failed to add NaCl process PID";
- return false;
- }
- }
-#endif
-
const ChildProcessData& data = process_->GetData();
NaClHostMsg_LaunchNaCl::WriteReplyParams(
reply_msg_, handle_for_renderer,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698