Fix cursor leak in ContactsBinaryDictionary

Bug: 6529131
Change-Id: I86493705fbf069ba7a6c43581cfbd1bcc27ff1ba
main
Tom Ouyang 2012-05-21 16:50:26 -07:00
parent 16950d65c3
commit 2798c85c0f
1 changed files with 5 additions and 1 deletions

View File

@ -149,7 +149,11 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
final Cursor cursor = mContext.getContentResolver().query(
Contacts.CONTENT_URI, PROJECTION_ID_ONLY, null, null, null);
if (cursor != null) {
return cursor.getCount();
try {
return cursor.getCount();
} finally {
cursor.close();
}
}
return 0;
}