Replace a manual buffer allocation with std::vector
am: b2b3323f45
Change-Id: I1f975913b04338073a6dd576614ecc0963bcaf8b
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