From 2798c85c0f77fdf4f12eccfe241f84ddec3de994 Mon Sep 17 00:00:00 2001 From: Tom Ouyang Date: Mon, 21 May 2012 16:50:26 -0700 Subject: [PATCH] Fix cursor leak in ContactsBinaryDictionary Bug: 6529131 Change-Id: I86493705fbf069ba7a6c43581cfbd1bcc27ff1ba --- .../android/inputmethod/latin/ContactsBinaryDictionary.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java index 4b77473d9..0a09c845e 100644 --- a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java @@ -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; }