Index: base/debug/close_handle_hook_win.cc |
diff --git a/base/debug/close_handle_hook_win.cc b/base/debug/close_handle_hook_win.cc |
index 70d40b21b5895db5f5a1f78c6cd3670df23b15f3..359b758ed33924727c59136265e60b97f4ac22ab 100644 |
--- a/base/debug/close_handle_hook_win.cc |
+++ b/base/debug/close_handle_hook_win.cc |
@@ -203,14 +203,15 @@ |
base::win::IATPatchFunction* patch = NULL; |
patch = IATPatch(module, "CloseHandle", &CloseHandleHook, |
reinterpret_cast<void**>(&g_close_function)); |
- if (patch) |
- hooks_.push_back(patch); |
+ if (!patch) |
+ return false; |
+ hooks_.push_back(patch); |
patch = IATPatch(module, "DuplicateHandle", &DuplicateHandleHook, |
reinterpret_cast<void**>(&g_duplicate_function)); |
- if (patch) |
- hooks_.push_back(patch); |
- |
+ if (!patch) |
+ return false; |
+ hooks_.push_back(patch); |
return true; |
} |
@@ -248,12 +249,15 @@ |
returned /= sizeof(HMODULE); |
returned = std::min(kSize, returned); |
+ bool success = false; |
+ |
for (DWORD current = 0; current < returned; current++) { |
- if (!hooks->AddIATPatch(modules[current])) |
- return false; |
- } |
- |
- return true; |
+ success = hooks->AddIATPatch(modules[current]); |
+ if (!success) |
+ break; |
+ } |
+ |
+ return success; |
} |
} // namespace |