Index: runtime/bin/directory_win.cc |
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc |
index e3e390f4292ac0bd7328ced0f9a65869afe5a457..3733a71384e5d734f7d4b52d1694aba85875238f 100644 |
--- a/runtime/bin/directory_win.cc |
+++ b/runtime/bin/directory_win.cc |
@@ -206,14 +206,18 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { |
return kListError; |
} |
- if (FindClose(reinterpret_cast<HANDLE>(lister_)) == 0) { |
- return kListError; |
- } |
- |
return kListDone; |
} |
+DirectoryListingEntry::~DirectoryListingEntry() { |
+ ResetLink(); |
+ if (lister_ != 0) { |
+ FindClose(reinterpret_cast<HANDLE>(lister_)); |
+ } |
+} |
+ |
+ |
void DirectoryListingEntry::ResetLink() { |
if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) { |
delete link_; |