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

Side by Side Diff: src/url_parse.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.cc ('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 /* Based on nsURLParsers.cc from Mozilla 1 /* Based on nsURLParsers.cc from Mozilla
2 * ------------------------------------- 2 * -------------------------------------
3 * The contents of this file are subject to the Mozilla Public License Version 3 * The contents of this file are subject to the Mozilla Public License Version
4 * 1.1 (the "License"); you may not use this file except in compliance with 4 * 1.1 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at 5 * the License. You may obtain a copy of the License at
6 * http://www.mozilla.org/MPL/ 6 * http://www.mozilla.org/MPL/
7 * 7 *
8 * Software distributed under the License is distributed on an "AS IS" basis, 8 * Software distributed under the License is distributed on an "AS IS" basis,
9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10 * for the specific language governing rights and limitations under the 10 * for the specific language governing rights and limitations under the
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 DCHECK(spec_len >= 0); 340 DCHECK(spec_len >= 0);
341 341
342 // Get the unused parts of the URL out of the way. 342 // Get the unused parts of the URL out of the way.
343 parsed->username.reset(); 343 parsed->username.reset();
344 parsed->password.reset(); 344 parsed->password.reset();
345 parsed->host.reset(); 345 parsed->host.reset();
346 parsed->port.reset(); 346 parsed->port.reset();
347 parsed->path.reset(); // May use this; reset for convenience. 347 parsed->path.reset(); // May use this; reset for convenience.
348 parsed->ref.reset(); // May use this; reset for convenience. 348 parsed->ref.reset(); // May use this; reset for convenience.
349 parsed->query.reset(); // May use this; reset for convenience. 349 parsed->query.reset(); // May use this; reset for convenience.
350 parsed->clear_inner_parsed(); // May use this; reset for convenience.
350 351
351 // Strip leading & trailing spaces and control characters. 352 // Strip leading & trailing spaces and control characters.
352 int begin = 0; 353 int begin = 0;
353 TrimURL(spec, &begin, &spec_len); 354 TrimURL(spec, &begin, &spec_len);
354 355
355 // Handle empty specs or ones that contain only whitespace or control chars. 356 // Handle empty specs or ones that contain only whitespace or control chars.
356 if (begin == spec_len) { 357 if (begin == spec_len) {
357 parsed->scheme.reset(); 358 parsed->scheme.reset();
358 return; 359 return;
359 } 360 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 914 }
914 915
915 void ParseAfterScheme(const char16* spec, 916 void ParseAfterScheme(const char16* spec,
916 int spec_len, 917 int spec_len,
917 int after_scheme, 918 int after_scheme,
918 Parsed* parsed) { 919 Parsed* parsed) {
919 DoParseAfterScheme(spec, spec_len, after_scheme, parsed); 920 DoParseAfterScheme(spec, spec_len, after_scheme, parsed);
920 } 921 }
921 922
922 } // namespace url_parse 923 } // namespace url_parse
OLDNEW
« no previous file with comments | « src/gurl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698