From 38f1b45d5017a5a05d6c0466219c54cd8af43f07 Mon Sep 17 00:00:00 2001 From: Cao Peng Date: Thu, 1 Jun 2023 18:16:26 +0800 Subject: [PATCH] Fix resource leakage caused by cursor Change-Id: I9507658cc82a2b9760507530920a37044f7de2fd Signed-off-by: Jia Jia --- .../settings/inputmethod/UserDictionaryCursorLoader.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/android/settings/inputmethod/UserDictionaryCursorLoader.java b/src/com/android/settings/inputmethod/UserDictionaryCursorLoader.java index e0c016f1219..bb8174ef91c 100644 --- a/src/com/android/settings/inputmethod/UserDictionaryCursorLoader.java +++ b/src/com/android/settings/inputmethod/UserDictionaryCursorLoader.java @@ -94,6 +94,8 @@ public class UserDictionaryCursorLoader extends CursorLoader { hashSet.add(hash); result.addRow(new Object[]{id, word, shortcut}); } + // The cursor needs to be closed after use, otherwise it will cause resource leakage + candidate.close(); return result; } }