fix 2533780 database cursors/statements is not closed in LauncherProvider.java
Change-Id: Iaf8ca76a15b153a1154b106247f81a0213183bcb
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 4bf4421..d50b19c 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -480,9 +480,10 @@
db.beginTransaction();
Cursor c = null;
+ SQLiteStatement update = null;
try {
boolean logged = false;
- final SQLiteStatement update = db.compileStatement("UPDATE favorites "
+ update = db.compileStatement("UPDATE favorites "
+ "SET icon=? WHERE _id=?");
c = db.rawQuery("SELECT _id, icon FROM favorites WHERE iconType=" +
@@ -506,8 +507,6 @@
update.execute();
}
bitmap.recycle();
- //noinspection UnusedAssignment
- bitmap = null;
}
} catch (Exception e) {
if (!logged) {
@@ -523,6 +522,9 @@
Log.w(TAG, "Problem while allocating appWidgetIds for existing widgets", ex);
} finally {
db.endTransaction();
+ if (update != null) {
+ update.close();
+ }
if (c != null) {
c.close();
}