From 0e205e6d6e8a032683597a0a1293925b7b9e462d Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 19 Oct 2011 17:54:20 +0200 Subject: [PATCH] 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 --- .../opengl/shared/OpenglCodecCommon/FixedBuffer.h | 11 +++++++---- .../system/OpenglSystemCommon/HostConnection.cpp | 2 ++ tools/emulator/opengl/system/egl/egl.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h index 1a18f473f..30b9a80ee 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h @@ -25,18 +25,21 @@ public: } ~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 29273416c..3355d9f1e 100644 --- a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp +++ b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp @@ -69,6 +69,7 @@ HostConnection *HostConnection::get() } if (stream->connect() < 0) { LOGE("Failed to connect to host (QemuPipeStream)!!!\n"); + delete stream; delete con; return NULL; } @@ -85,6 +86,7 @@ HostConnection *HostConnection::get() 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 e9bae3ae3..37a9becde 100644 --- a/tools/emulator/opengl/system/egl/egl.cpp +++ b/tools/emulator/opengl/system/egl/egl.cpp @@ -146,8 +146,10 @@ EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* share 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()