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

Side by Side Diff: runtime/bin/file_win.cc

Issue 172153007: Don't leak file names in Windows File::Stat(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <fcntl.h> // NOLINT 10 #include <fcntl.h> // NOLINT
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 461 }
462 462
463 463
464 void File::Stat(const char* name, int64_t* data) { 464 void File::Stat(const char* name, int64_t* data) {
465 File::Type type = GetType(name, false); 465 File::Type type = GetType(name, false);
466 data[kType] = type; 466 data[kType] = type;
467 if (type != kDoesNotExist) { 467 if (type != kDoesNotExist) {
468 struct _stat64 st; 468 struct _stat64 st;
469 const wchar_t* system_name = StringUtils::Utf8ToWide(name); 469 const wchar_t* system_name = StringUtils::Utf8ToWide(name);
470 int stat_status = _wstat64(system_name, &st); 470 int stat_status = _wstat64(system_name, &st);
471 free(const_cast<wchar_t*>(system_name));
471 if (stat_status == 0) { 472 if (stat_status == 0) {
472 data[kCreatedTime] = st.st_ctime; 473 data[kCreatedTime] = st.st_ctime;
473 data[kModifiedTime] = st.st_mtime; 474 data[kModifiedTime] = st.st_mtime;
474 data[kAccessedTime] = st.st_atime; 475 data[kAccessedTime] = st.st_atime;
475 data[kMode] = st.st_mode; 476 data[kMode] = st.st_mode;
476 data[kSize] = st.st_size; 477 data[kSize] = st.st_size;
477 } else { 478 } else {
478 data[kType] = File::kDoesNotExist; 479 data[kType] = File::kDoesNotExist;
479 } 480 }
480 } 481 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return kIdentical; 641 return kIdentical;
641 } else { 642 } else {
642 return kDifferent; 643 return kDifferent;
643 } 644 }
644 } 645 }
645 646
646 } // namespace bin 647 } // namespace bin
647 } // namespace dart 648 } // namespace dart
648 649
649 #endif // defined(TARGET_OS_WINDOWS) 650 #endif // defined(TARGET_OS_WINDOWS)
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