Fix memory-handling issues in the OpenGL code.
This fixes the folloiwng cppcheck reports:
[device/generic/goldfish/opengl/system/GLESv2_enc/GL2Encoder.cpp:789]:
(error) Mismatching allocation and deallocation: str
[device/generic/goldfish/opengl/system/GLESv2_enc/GL2Encoder.cpp:795]:
(error) Mismatching allocation and deallocation: str
[device/generic/goldfish/opengl/tests/gles_android_wrapper/egl.cpp:492]:
(error) Mismatching allocation and deallocation: attrib
Change-Id: Iaf494eca1b927b2fa4b91f01ba340746b9da9bd3
(cherry picked from commit 3375e5e21450b78daf109225707d574976b7ec1c)
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 853a6a7..119500d 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -803,13 +803,13 @@
// Perhaps we can borrow Mesa's pre-processor?
if (!replaceSamplerExternalWith2D(str, shaderData)) {
- delete str;
+ delete[] str;
ctx->setError(GL_OUT_OF_MEMORY);
return;
}
ctx->glShaderString(ctx, shader, str, len + 1);
- delete str;
+ delete[] str;
}
void GL2Encoder::s_glFinish(void *self)