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

Side by Side Diff: src/string-stream.cc

Issue 155917: Fix two deallocation bugs identified by Coverity Prevent.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | « src/string-stream.h ('k') | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 26 matching lines...) Expand all
37 static List<HeapObject*, PreallocatedStorage>* debug_object_cache = NULL; 37 static List<HeapObject*, PreallocatedStorage>* debug_object_cache = NULL;
38 static Object* current_security_token = NULL; 38 static Object* current_security_token = NULL;
39 39
40 40
41 char* HeapStringAllocator::allocate(unsigned bytes) { 41 char* HeapStringAllocator::allocate(unsigned bytes) {
42 space_ = NewArray<char>(bytes); 42 space_ = NewArray<char>(bytes);
43 return space_; 43 return space_;
44 } 44 }
45 45
46 46
47 NoAllocationStringAllocator::NoAllocationStringAllocator(unsigned bytes) {
48 size_ = bytes;
49 space_ = NewArray<char>(bytes);
50 }
51
52
53 NoAllocationStringAllocator::NoAllocationStringAllocator(char* memory, 47 NoAllocationStringAllocator::NoAllocationStringAllocator(char* memory,
54 unsigned size) { 48 unsigned size) {
55 size_ = size; 49 size_ = size;
56 space_ = memory; 50 space_ = memory;
57 } 51 }
58 52
59 53
60 bool StringStream::Put(char c) { 54 bool StringStream::Put(char c) {
61 if (full()) return false; 55 if (full()) return false;
62 ASSERT(length_ < capacity_); 56 ASSERT(length_ < capacity_);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 568
575 // Only grow once to the maximum allowable size. 569 // Only grow once to the maximum allowable size.
576 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 570 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
577 ASSERT(size_ >= *bytes); 571 ASSERT(size_ >= *bytes);
578 *bytes = size_; 572 *bytes = size_;
579 return space_; 573 return space_;
580 } 574 }
581 575
582 576
583 } } // namespace v8::internal 577 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/string-stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698