opengles emulator: GLES memory leaks
fix some memory leaks detected in valgrind
Change-Id: I48d91223c520c9c10b797a89a679eed7a950a3e6
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
index 7c8edc0..dc8517c 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
@@ -261,7 +261,7 @@
s_egl.eglChooseConfig(dpy, newAttribs, matchedConfigs, nConfigs, &nConfigs);
- delete newAttribs;
+ delete[] newAttribs;
//
// From all matchedConfigs we need only config_size FBConfigs, so we intersect both lists compating the CONFIG_ID attribute
@@ -284,7 +284,7 @@
}
}
- delete matchedConfigs;
+ delete[] matchedConfigs;
return nVerifiedCfgs;
}
@@ -308,6 +308,6 @@
FBConfig::~FBConfig()
{
if (m_attribValues) {
- delete m_attribValues;
+ delete[] m_attribValues;
}
}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
index 7b8223d..1a18f47 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
@@ -32,7 +32,7 @@
void * alloc(size_t size) {
if (m_bufferLen >= size) return (void *)(m_buffer);
- if (m_buffer != NULL) delete m_buffer;
+ if (m_buffer != NULL) delete[] m_buffer;
m_bufferLen = size;
m_buffer = new unsigned char[m_bufferLen];