Fix cursor leak in ContactsBinaryDictionary

Bug: 6529131
Change-Id: I86493705fbf069ba7a6c43581cfbd1bcc27ff1ba
This commit is contained in:
Tom Ouyang 2012-05-21 16:50:26 -07:00
parent 16950d65c3
commit 2798c85c0f

View file

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