Close the cursor before assigning a new one to the same variable.
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 6d66296..062080d 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -345,6 +345,7 @@
baseUri.buildUpon().appendPath(String.valueOf(origId))
.toString().replaceFirst("thumbnails", "media"));
if (filePath == null) {
+ if (c != null) c.close();
c = cr.query(uri, PROJECTION, null, null, null);
if (c == null || !c.moveToFirst()) {
return null;