summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2014-10-17 17:52:13 -0700
committerAndrew Sapperstein <asapperstein@google.com>2014-10-18 00:56:01 +0000
commit0437e862005912a1e5bf054769f23ed9cc69f811 (patch)
tree1c2c6eb5b074854febbc0a0205a95ae9cc55aac3
parent50fcac9f8629f6b02408c787e46ff4119698cc01 (diff)
downloadandroid_frameworks_opt_chips-0437e862005912a1e5bf054769f23ed9cc69f811.tar.gz
android_frameworks_opt_chips-0437e862005912a1e5bf054769f23ed9cc69f811.tar.bz2
android_frameworks_opt_chips-0437e862005912a1e5bf054769f23ed9cc69f811.zip
Close directoryCursor. b/17949234
Fixes b/18039002. Change-Id: I88c23adb63ba64ca9f638086ad1c29a7fb839868
-rw-r--r--src/com/android/ex/chips/BaseRecipientAdapter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/android/ex/chips/BaseRecipientAdapter.java b/src/com/android/ex/chips/BaseRecipientAdapter.java
index 151bdcd..070f7ad 100644
--- a/src/com/android/ex/chips/BaseRecipientAdapter.java
+++ b/src/com/android/ex/chips/BaseRecipientAdapter.java
@@ -321,10 +321,17 @@ public class BaseRecipientAdapter extends BaseAdapter implements Filterable, Acc
+ existingDestinations.size()
+ ", remaining limit: " + limit + ") ");
}
- final Cursor directoryCursor = mContentResolver.query(
- DirectoryListQuery.URI, DirectoryListQuery.PROJECTION,
- null, null, null);
- return setupOtherDirectories(mContext, directoryCursor, mAccount);
+ Cursor directoryCursor = null;
+ try {
+ directoryCursor = mContentResolver.query(
+ DirectoryListQuery.URI, DirectoryListQuery.PROJECTION,
+ null, null, null);
+ return setupOtherDirectories(mContext, directoryCursor, mAccount);
+ } finally {
+ if (directoryCursor != null) {
+ directoryCursor.close();
+ }
+ }
} else {
// We don't need to search other directories.
return null;