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

Unified Diff: util/mac/process_reader.cc

Issue 493203005: Add ScopedForbidReturn and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: clang-format Created 6 years, 4 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 | util/misc/scoped_forbid_return.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/process_reader.cc
diff --git a/util/mac/process_reader.cc b/util/mac/process_reader.cc
index 27fa4c5eeccf994b0c96d8b0aaa46ef2cc6cbead..7013f7ec70ff88c5bfd44e9aa9d8e737490ab351 100644
--- a/util/mac/process_reader.cc
+++ b/util/mac/process_reader.cc
@@ -24,6 +24,7 @@
#include "base/mac/mach_logging.h"
#include "base/mac/scoped_mach_port.h"
#include "base/mac/scoped_mach_vm.h"
+#include "util/misc/scoped_forbid_return.h"
namespace {
@@ -221,6 +222,7 @@ void ProcessReader::InitializeThreads() {
// by anything until they’re added to |threads_| by the loop below. Any early
// return (or exception) that happens between here and the completion of the
// loop below will leak thread port send rights.
+ ScopedForbidReturn threads_need_owners;
base::mac::ScopedMachVM threads_vm(
reinterpret_cast<vm_address_t>(threads),
@@ -340,6 +342,8 @@ void ProcessReader::InitializeThreads() {
threads_.push_back(thread);
}
+
+ threads_need_owners.Disarm();
}
void ProcessReader::InitializeModules() {
« no previous file with comments | « no previous file | util/misc/scoped_forbid_return.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698