Replace a manual buffer allocation with std::vector am: b2b3323f45 am: 50cd609aa0
am: b869d4b4d3
Change-Id: I2b6d309b494c9090abbc46f27da0893adc6404e5
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index a08873d..851f3b0 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -45,6 +45,7 @@
#include <set>
#include <map>
+#include <vector>
#include <string>
#include <sstream>
@@ -384,11 +385,11 @@
cb->frameworkFormat != HAL_PIXEL_FORMAT_YV12 &&
cb->frameworkFormat != HAL_PIXEL_FORMAT_YCbCr_420_888;
- char* convertedBuf = NULL;
+ std::vector<char> convertedBuf;
if ((doLocked && is_rgb_format) ||
(!grdma && (doLocked || !is_rgb_format))) {
- convertedBuf = new char[rgbSz];
- to_send = convertedBuf;
+ convertedBuf.resize(rgbSz);
+ to_send = convertedBuf.data();
send_buffer_size = rgbSz;
}
@@ -439,8 +440,6 @@
left, top, width, height,
cb->glFormat, cb->glType, to_send);
}
-
- if (convertedBuf) delete [] convertedBuf;
}
#ifndef GL_RGBA16F