Fix the following warning:
Potential leak of memory pointed to by 'b'
[clang-analyzer-cplusplus.NewDeleteLeaks]
Bug: b/
27101951
Test:Warning is gone.
Change-Id: If898bae71771f325c97777a19af0c0cf2e8a0400
#include <utils/Mutex.h>
#include <utils/Condition.h>
+#include <vector>
#define CPU_CONSUMER_TEST_FORMAT_RAW 0
#define CPU_CONSUMER_TEST_FORMAT_Y8 0
#define CPU_CONSUMER_TEST_FORMAT_Y16 0
// Consume
- CpuConsumer::LockedBuffer *b = new CpuConsumer::LockedBuffer[params.maxLockedBuffers];
+ std::vector<CpuConsumer::LockedBuffer> b(params.maxLockedBuffers);
for (int i = 0; i < params.maxLockedBuffers; i++) {
ALOGV("Locking frame %d", i);
err = mCC->lockNextBuffer(&b[i]);
for (int i = 1; i < params.maxLockedBuffers; i++) {
mCC->unlockBuffer(b[i]);
}
-
- delete[] b;
-
}
CpuConsumerTestParams y8TestSets[] = {