am b9c597a7: am 2798c85c: Fix cursor leak in ContactsBinaryDictionary

* commit 'b9c597a72d2e20a23351a832916cea7353f4fc41':
  Fix cursor leak in ContactsBinaryDictionary
This commit is contained in:
Tom Ouyang 2012-05-21 17:15:28 -07:00 committed by Android Git Automerger
commit c6f4d16826

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;
} }