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

Side by Side Diff: src/gurl.cc

Issue 9838097: Fix a memory leak; properly initialize inner_parsed before use. (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 9 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/gurl.h ('k') | src/url_parse.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007, Google Inc. 1 // Copyright 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 DCHECK(test_url.parsed_.host == parsed_.host); 173 DCHECK(test_url.parsed_.host == parsed_.host);
174 DCHECK(test_url.parsed_.port == parsed_.port); 174 DCHECK(test_url.parsed_.port == parsed_.port);
175 DCHECK(test_url.parsed_.path == parsed_.path); 175 DCHECK(test_url.parsed_.path == parsed_.path);
176 DCHECK(test_url.parsed_.query == parsed_.query); 176 DCHECK(test_url.parsed_.query == parsed_.query);
177 DCHECK(test_url.parsed_.ref == parsed_.ref); 177 DCHECK(test_url.parsed_.ref == parsed_.ref);
178 } 178 }
179 } 179 }
180 #endif 180 #endif
181 } 181 }
182 182
183 GURL::~GURL() {
184 delete inner_url_;
185 }
186
183 GURL& GURL::operator=(const GURL& other) { 187 GURL& GURL::operator=(const GURL& other) {
184 spec_ = other.spec_; 188 spec_ = other.spec_;
185 is_valid_ = other.is_valid_; 189 is_valid_ = other.is_valid_;
186 parsed_ = other.parsed_; 190 parsed_ = other.parsed_;
187 delete inner_url_; 191 delete inner_url_;
188 inner_url_ = NULL; 192 inner_url_ = NULL;
189 if (other.inner_url_) 193 if (other.inner_url_)
190 inner_url_ = new GURL(*other.inner_url_); 194 inner_url_ = new GURL(*other.inner_url_);
191 return *this; 195 return *this;
192 } 196 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 void GURL::Swap(GURL* other) { 503 void GURL::Swap(GURL* other) {
500 spec_.swap(other->spec_); 504 spec_.swap(other->spec_);
501 std::swap(is_valid_, other->is_valid_); 505 std::swap(is_valid_, other->is_valid_);
502 std::swap(parsed_, other->parsed_); 506 std::swap(parsed_, other->parsed_);
503 std::swap(inner_url_, other->inner_url_); 507 std::swap(inner_url_, other->inner_url_);
504 } 508 }
505 509
506 std::ostream& operator<<(std::ostream& out, const GURL& url) { 510 std::ostream& operator<<(std::ostream& out, const GURL& url) {
507 return out << url.possibly_invalid_spec(); 511 return out << url.possibly_invalid_spec();
508 } 512 }
OLDNEW
« no previous file with comments | « src/gurl.h ('k') | src/url_parse.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698