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

Commit 5662dac2 authored by Devin Moore's avatar Devin Moore Committed by Automerger Merge Worker
Browse files

Remove some new memory leaks from SensorManager am: 6447432d

parents e55af01f 6447432d
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -66,7 +66,11 @@ public:
        v.setCapacity(n);
        while (n) {
            n--;
            reply.read(s);
            if(reply.read(s) != OK) {
                ALOGE("Failed to read reply from getSensorList");
                v.clear();
                break;
            }
            v.add(s);
        }
        return v;
@@ -84,7 +88,11 @@ public:
        v.setCapacity(n);
        while (n) {
            n--;
            reply.read(s);
            if(reply.read(s) != OK) {
                ALOGE("Failed to read reply from getDynamicSensorList");
                v.clear();
                break;
            }
            v.add(s);
        }
        return v;
+5 −0
Original line number Diff line number Diff line
@@ -162,6 +162,11 @@ status_t SensorManager::assertStateLocked() {

        mSensors = mSensorServer->getSensorList(mOpPackageName);
        size_t count = mSensors.size();
        if (count == 0) {
            ALOGE("Failed to get Sensor list");
            mSensorServer.clear();
            return UNKNOWN_ERROR;
        }
        mSensorList =
                static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
        LOG_ALWAYS_FATAL_IF(mSensorList == nullptr, "mSensorList NULL");