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

Commit 1dc092f0 authored by Chih-hung Hsieh's avatar Chih-hung Hsieh Committed by Automerger Merge Worker
Browse files

Merge "Fix potential memory leaks" am: 486cad37 am: 07ce6d13 am: 6d4d0f1b

parents bc9ba5b1 6d4d0f1b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#define LOG_TAG "CodecListTest"
#include <utils/Log.h>

#include <memory>

#include <gtest/gtest.h>

#include <binder/Parcel.h>
@@ -194,16 +196,15 @@ TEST(CodecInfoTest, ListInfoTest) {
            }
        }

        Parcel *codecInfoParcel = new Parcel();
        std::unique_ptr<Parcel> codecInfoParcel(new Parcel());
        ASSERT_NE(codecInfoParcel, nullptr) << "Unable to create parcel";

        status_t status = info->writeToParcel(codecInfoParcel);
        status_t status = info->writeToParcel(codecInfoParcel.get());
        ASSERT_EQ(status, OK) << "Writing to parcel failed";

        codecInfoParcel->setDataPosition(0);
        sp<MediaCodecInfo> parcelCodecInfo = info->FromParcel(*codecInfoParcel);
        ASSERT_NE(parcelCodecInfo, nullptr) << "CodecInfo from parcel is null";
        delete codecInfoParcel;

        EXPECT_STREQ(info->getCodecName(), parcelCodecInfo->getCodecName())
                << "Returned codec name in info doesn't match";