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

Side by Side Diff: src/log.cc

Issue 7218036: Prevent a NULL deref (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 6 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 393 }
394 } 394 }
395 395
396 const char* Lookup(Address code_address) { 396 const char* Lookup(Address code_address) {
397 HashMap::Entry* entry = FindEntry(code_address); 397 HashMap::Entry* entry = FindEntry(code_address);
398 return (entry != NULL) ? static_cast<const char*>(entry->value) : NULL; 398 return (entry != NULL) ? static_cast<const char*>(entry->value) : NULL;
399 } 399 }
400 400
401 void Remove(Address code_address) { 401 void Remove(Address code_address) {
402 HashMap::Entry* entry = FindEntry(code_address); 402 HashMap::Entry* entry = FindEntry(code_address);
403 if (entry != NULL) DeleteArray(static_cast<const char*>(entry->value)); 403 if (entry != NULL) {
404 RemoveEntry(entry); 404 DeleteArray(static_cast<const char*>(entry->value));
mnaganov (inactive) 2011/06/22 05:02:47 We allocate an array of char, why do we cast to co
groby-ooo-7-16 2011/06/22 17:17:26 Presumably because DeleteArray takes a pointer to
mnaganov (inactive) 2011/06/22 18:54:23 I mean that a name string is allocated like this:
405 RemoveEntry(entry);
406 }
405 } 407 }
406 408
407 void Move(Address from, Address to) { 409 void Move(Address from, Address to) {
408 if (from == to) return; 410 if (from == to) return;
409 HashMap::Entry* from_entry = FindEntry(from); 411 HashMap::Entry* from_entry = FindEntry(from);
410 ASSERT(from_entry != NULL); 412 ASSERT(from_entry != NULL);
411 void* value = from_entry->value; 413 void* value = from_entry->value;
412 RemoveEntry(from_entry); 414 RemoveEntry(from_entry);
413 HashMap::Entry* to_entry = FindOrCreateEntry(to); 415 HashMap::Entry* to_entry = FindOrCreateEntry(to);
414 ASSERT(to_entry->value == NULL); 416 ASSERT(to_entry->value == NULL);
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { 1993 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) {
1992 ASSERT(sampler->IsActive()); 1994 ASSERT(sampler->IsActive());
1993 ScopedLock lock(mutex_); 1995 ScopedLock lock(mutex_);
1994 ASSERT(active_samplers_ != NULL); 1996 ASSERT(active_samplers_ != NULL);
1995 bool removed = active_samplers_->RemoveElement(sampler); 1997 bool removed = active_samplers_->RemoveElement(sampler);
1996 ASSERT(removed); 1998 ASSERT(removed);
1997 USE(removed); 1999 USE(removed);
1998 } 2000 }
1999 2001
2000 } } // namespace v8::internal 2002 } } // namespace v8::internal
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