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

Unified Diff: src/platform-win32.cc

Issue 1737023: Turn some usages of NewArray with DeleteArray in the same scope into ScopedVector or SmartPointer. (Closed)
Patch Set: Disabling implicit constructors Created 10 years, 8 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 | « src/platform-solaris.cc ('k') | src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index d03a0a964e8496830b0a954ae9b645dc775258e2..d55cde91f879321cae8662585471a19398755664 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -1249,16 +1249,16 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
// Try to locate a symbol for this frame.
DWORD64 symbol_displacement;
- IMAGEHLP_SYMBOL64* symbol = NULL;
- symbol = NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen);
+ SmartPointer<IMAGEHLP_SYMBOL64> symbol(
+ NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen));
if (!symbol) return kStackWalkError; // Out of memory.
- memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen);
+ memset(*symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen);
symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
symbol->MaxNameLength = kStackWalkMaxNameLen;
ok = _SymGetSymFromAddr64(process_handle, // hProcess
stack_frame.AddrPC.Offset, // Address
&symbol_displacement, // Displacement
- symbol); // Symbol
+ *symbol); // Symbol
if (ok) {
// Try to locate more source information for the symbol.
IMAGEHLP_LINE64 Line;
@@ -1294,11 +1294,9 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
// module will never be found).
int err = GetLastError();
if (err != ERROR_MOD_NOT_FOUND) {
- DeleteArray(symbol);
break;
}
}
- DeleteArray(symbol);
frames_count++;
}
« no previous file with comments | « src/platform-solaris.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698