Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 215545be authored by George Burgess IV's avatar George Burgess IV
Browse files

Fix a memory leak

`if (index != 1)` below, we'd leak this memory.

Caught by the static analyzer:

frameworks/av/media/libmedia/MediaProfiles.cpp:573:21: warning:
Potential leak of memory pointed to by 'profile'
[clang-analyzer-cplusplus.NewDeleteLeaks]

Bug: None
Test: Ran the analyzer again.
Change-Id: I3a8641358294a2d405cdf4d00fb1af86d893f9dc
parent 69b95935
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -546,8 +546,8 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() {

            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 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() {
                        mCamcorderProfiles[info->mRefProfileIndex]->mQuality,
                        profile->mQuality, cameraId);

                mCamcorderProfiles.add(profile);
                mCamcorderProfiles.add(profile.release());
            }
        }
    }