Merge "Fix a memory leak"
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index aade69a..e0f5a40 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -546,8 +546,8 @@
if (info->mHasRefProfile) {
- CamcorderProfile *profile =
- new CamcorderProfile(
+ std::unique_ptr<CamcorderProfile> profile =
+ std::make_unique<CamcorderProfile>(
*mCamcorderProfiles[info->mRefProfileIndex]);
// Overwrite the quality
@@ -581,7 +581,7 @@
mCamcorderProfiles[info->mRefProfileIndex]->mQuality,
profile->mQuality, cameraId);
- mCamcorderProfiles.add(profile);
+ mCamcorderProfiles.add(profile.release());
}
}
}