Index: runtime/bin/directory_android.cc |
diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc |
index 7dd450ab503840d950e2af63557642462cb02e47..02f841deb3321318fc8ad505a82cb2bec7f94149 100644 |
--- a/runtime/bin/directory_android.cc |
+++ b/runtime/bin/directory_android.cc |
@@ -187,14 +187,18 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { |
return kListError; |
} |
- if (closedir(reinterpret_cast<DIR*>(lister_)) == -1) { |
- return kListError; |
- } |
- |
return kListDone; |
} |
+DirectoryListingEntry::~DirectoryListingEntry() { |
+ ResetLink(); |
+ if (lister_ != 0) { |
+ closedir(reinterpret_cast<DIR*>(lister_)); |
+ } |
+} |
+ |
+ |
void DirectoryListingEntry::ResetLink() { |
if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) { |
delete link_; |