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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 683913009: Eliminate resource leaks from zip::ZipFiles and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 6 years, 1 month 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
« no previous file with comments | « chrome/common/safe_browsing/zip_analyzer.cc ('k') | third_party/zlib/google/zip.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void ChromeContentUtilityClient::OnDecodeImage( 244 void ChromeContentUtilityClient::OnDecodeImage(
245 const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) { 245 const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) {
246 DecodeImageAndSend(encoded_data, shrink_to_fit); 246 DecodeImageAndSend(encoded_data, shrink_to_fit);
247 } 247 }
248 248
249 #if defined(OS_CHROMEOS) 249 #if defined(OS_CHROMEOS)
250 void ChromeContentUtilityClient::OnCreateZipFile( 250 void ChromeContentUtilityClient::OnCreateZipFile(
251 const base::FilePath& src_dir, 251 const base::FilePath& src_dir,
252 const std::vector<base::FilePath>& src_relative_paths, 252 const std::vector<base::FilePath>& src_relative_paths,
253 const base::FileDescriptor& dest_fd) { 253 const base::FileDescriptor& dest_fd) {
254 // dest_fd should be closed in the function. See ipc/ipc_message_util.h for
255 // details.
256 base::ScopedFD fd_closer(dest_fd.fd);
254 bool succeeded = true; 257 bool succeeded = true;
255 258
256 // Check sanity of source relative paths. Reject if path is absolute or 259 // Check sanity of source relative paths. Reject if path is absolute or
257 // contains any attempt to reference a parent directory ("../" tricks). 260 // contains any attempt to reference a parent directory ("../" tricks).
258 for (std::vector<base::FilePath>::const_iterator iter = 261 for (std::vector<base::FilePath>::const_iterator iter =
259 src_relative_paths.begin(); iter != src_relative_paths.end(); 262 src_relative_paths.begin(); iter != src_relative_paths.end();
260 ++iter) { 263 ++iter) {
261 if (iter->IsAbsolute() || iter->ReferencesParent()) { 264 if (iter->IsAbsolute() || iter->ReferencesParent()) {
262 succeeded = false; 265 succeeded = false;
263 break; 266 break;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 const std::string& mime_type, int64 total_size, bool get_attached_images) { 351 const std::string& mime_type, int64 total_size, bool get_attached_images) {
349 // Only one IPCDataSource may be created and added to the list of handlers. 352 // Only one IPCDataSource may be created and added to the list of handlers.
350 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); 353 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
351 handlers_.push_back(source); 354 handlers_.push_back(source);
352 355
353 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( 356 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser(
354 source, mime_type, get_attached_images); 357 source, mime_type, get_attached_images);
355 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); 358 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser)));
356 } 359 }
357 #endif 360 #endif
OLDNEW
« no previous file with comments | « chrome/common/safe_browsing/zip_analyzer.cc ('k') | third_party/zlib/google/zip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698