emulator: opengl: minor fix and reformatting
This patches fixes a minor invalid usage of delete (instead of delete[])
and reformats the source code a little to make it more obvious.
Change-Id: If853d12e74549abcc6682430c837b0f14da81fdc
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
index 1a18f47..30b9a80 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
@@ -25,18 +25,21 @@
}
~FixedBuffer() {
- delete m_buffer;
+ delete [] m_buffer;
m_bufferLen = 0;
}
void * alloc(size_t size) {
- if (m_bufferLen >= size) return (void *)(m_buffer);
+ 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];
- if (m_buffer == NULL) m_bufferLen = 0;
+ if (m_buffer == NULL)
+ m_bufferLen = 0;
return m_buffer;
}
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
index 2927341..3355d9f 100644
--- a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
+++ b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
@@ -69,6 +69,7 @@
}
if (stream->connect() < 0) {
LOGE("Failed to connect to host (QemuPipeStream)!!!\n");
+ delete stream;
delete con;
return NULL;
}
@@ -85,6 +86,7 @@
if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
LOGE("Failed to connect to host (TcpStream)!!!\n");
+ delete stream;
delete con;
return NULL;
}
diff --git a/tools/emulator/opengl/system/egl/egl.cpp b/tools/emulator/opengl/system/egl/egl.cpp
index e9bae3a..37a9bec 100644
--- a/tools/emulator/opengl/system/egl/egl.cpp
+++ b/tools/emulator/opengl/system/egl/egl.cpp
@@ -146,8 +146,10 @@
flags = 0;
version = 1;
clientState = new GLClientState();
- if (shareCtx) sharedGroup = shareCtx->getSharedGroup();
- else sharedGroup = GLSharedGroupPtr(new GLSharedGroup());
+ if (shareCtx)
+ sharedGroup = shareCtx->getSharedGroup();
+ else
+ sharedGroup = GLSharedGroupPtr(new GLSharedGroup());
};
EGLContext_t::~EGLContext_t()