summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Tate <ctate@android.com> 2014-01-10 00:07:09 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-01-10 00:07:09 +0000
commit1f5ca7fed219f35d9219e6e88791fdce356b627d (patch)
treea47e6216ec088678a9f397be98ec28c0b10e48fd
parentddf89c0cc847d1fac4d9885d2c91a2fb700e9d0c (diff)
parent7b3cfebce3ab51e96d6c89317ea48b8bce640d9d (diff)
am 7b3cfebc: am f1fbe113: am 4ba1bbad: am 5fbcb134: am 35b7de4c: Merge "Cursor leakage due to cancellation signal"
* commit '7b3cfebce3ab51e96d6c89317ea48b8bce640d9d': Cursor leakage due to cancellation signal
-rw-r--r--core/java/android/content/ContentProviderNative.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index bcf0b637a213..39286d6ea9b6 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -112,17 +112,24 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
Cursor cursor = query(callingPkg, url, projection, selection, selectionArgs,
sortOrder, cancellationSignal);
if (cursor != null) {
+ CursorToBulkCursorAdaptor adaptor = null;
+
try {
- CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor(
- cursor, observer, getProviderName());
- BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
+ adaptor = new CursorToBulkCursorAdaptor(cursor, observer,
+ getProviderName());
cursor = null;
+ BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
+ adaptor = null;
+
reply.writeNoException();
reply.writeInt(1);
d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} finally {
// Close cursor if an exception was thrown while constructing the adaptor.
+ if (adaptor != null) {
+ adaptor.close();
+ }
if (cursor != null) {
cursor.close();
}