summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media/java/android/media/Metadata.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/media/java/android/media/Metadata.java b/media/java/android/media/Metadata.java
index 792a2ba678fd..be0d966fa075 100644
--- a/media/java/android/media/Metadata.java
+++ b/media/java/android/media/Metadata.java
@@ -272,6 +272,15 @@ import java.util.TimeZone;
@UnsupportedAppUsage
public Metadata() { }
+ // Have to declare protected for finalize() since it is protected
+ // in the base class Object.
+ @Override
+ protected void finalize() throws Throwable {
+ if (mParcel != null) {
+ mParcel.recycle();
+ }
+ }
+
/**
* Go over all the records, collecting metadata keys and records'
* type field offset in the Parcel. These are stored in
@@ -418,6 +427,10 @@ import java.util.TimeZone;
parcel.setDataPosition(pin);
return false;
}
+
+ if (mParcel != null) {
+ mParcel.recycle();
+ }
mParcel = parcel;
return true;
}