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

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

Remove some new memory leaks from SensorManager am: d3909793

parents 72715e33 d3909793
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -67,7 +67,11 @@ public:
        v.setCapacity(n);
        v.setCapacity(n);
        while (n) {
        while (n) {
            n--;
            n--;
            reply.read(s);
            if(reply.read(s) != OK) {
                ALOGE("Failed to read reply from getSensorList");
                v.clear();
                break;
            }
            v.add(s);
            v.add(s);
        }
        }
        return v;
        return v;
@@ -85,7 +89,11 @@ public:
        v.setCapacity(n);
        v.setCapacity(n);
        while (n) {
        while (n) {
            n--;
            n--;
            reply.read(s);
            if(reply.read(s) != OK) {
                ALOGE("Failed to read reply from getDynamicSensorList");
                v.clear();
                break;
            }
            v.add(s);
            v.add(s);
        }
        }
        return v;
        return v;
+5 −0
Original line number Original line Diff line number Diff line
@@ -166,6 +166,11 @@ status_t SensorManager::assertStateLocked() {


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