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

Side by Side Diff: runtime/vm/os_linux.cc

Issue 12026036: Fix use after free bug in PprofCodeObserver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/os.h" 5 #include "vm/os.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <malloc.h> 9 #include <malloc.h>
10 #include <time.h> 10 #include <time.h>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return; 105 return;
106 } 106 }
107 const char* filename = FLAG_generate_pprof_symbols; 107 const char* filename = FLAG_generate_pprof_symbols;
108 void* out_file = (*file_open)(filename); 108 void* out_file = (*file_open)(filename);
109 ASSERT(out_file != NULL); 109 ASSERT(out_file != NULL);
110 DebugInfo::ByteBuffer* debug_region = new DebugInfo::ByteBuffer(); 110 DebugInfo::ByteBuffer* debug_region = new DebugInfo::ByteBuffer();
111 ASSERT(debug_region != NULL); 111 ASSERT(debug_region != NULL);
112 pprof_symbol_generator_->WriteToMemory(debug_region); 112 pprof_symbol_generator_->WriteToMemory(debug_region);
113 int buffer_size = debug_region->size(); 113 int buffer_size = debug_region->size();
114 void* buffer = debug_region->data(); 114 void* buffer = debug_region->data();
115 delete debug_region;
116 if (buffer_size > 0) { 115 if (buffer_size > 0) {
117 ASSERT(buffer != NULL); 116 ASSERT(buffer != NULL);
118 (*file_write)(buffer, buffer_size, out_file); 117 (*file_write)(buffer, buffer_size, out_file);
119 } 118 }
119 delete debug_region;
120 (*file_close)(out_file); 120 (*file_close)(out_file);
121 DebugInfo::UnregisterAllSections(); 121 DebugInfo::UnregisterAllSections();
122 } 122 }
123 123
124 virtual bool IsActive() const { 124 virtual bool IsActive() const {
125 return FLAG_generate_pprof_symbols != NULL; 125 return FLAG_generate_pprof_symbols != NULL;
126 } 126 }
127 127
128 virtual void Notify(const char* name, 128 virtual void Notify(const char* name,
129 uword base, 129 uword base,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 void OS::Abort() { 400 void OS::Abort() {
401 abort(); 401 abort();
402 } 402 }
403 403
404 404
405 void OS::Exit(int code) { 405 void OS::Exit(int code) {
406 exit(code); 406 exit(code);
407 } 407 }
408 408
409 } // namespace dart 409 } // namespace dart
OLDNEW
« 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