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

Commit f4b75c9a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix potential memory leak." into pi-dev

parents 19809964 fdd2cad2
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -341,10 +341,10 @@ status_t BnCrypto::onTransact(
                return OK;
            }

            CryptoPlugin::SubSample *subSamples =
                    new CryptoPlugin::SubSample[numSubSamples];
            std::unique_ptr<CryptoPlugin::SubSample[]> subSamples =
                    std::make_unique<CryptoPlugin::SubSample[]>(numSubSamples);

            data.read(subSamples,
            data.read(subSamples.get(),
                    sizeof(CryptoPlugin::SubSample) * numSubSamples);

            DestinationBuffer destination;
@@ -402,7 +402,7 @@ status_t BnCrypto::onTransact(
                result = -EINVAL;
            } else {
                result = decrypt(key, iv, mode, pattern, source, offset,
                        subSamples, numSubSamples, destination, &errorDetailMsg);
                        subSamples.get(), numSubSamples, destination, &errorDetailMsg);
            }

            reply->writeInt32(result);
@@ -421,9 +421,7 @@ status_t BnCrypto::onTransact(
                }
            }

            delete[] subSamples;
            subSamples = NULL;

            subSamples.reset();
            return OK;
        }