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++; |
} |