Merge "opengles emulator: GLES fix memory leaks"

This commit is contained in:
David Turner
2011-08-10 01:58:48 -07:00
committed by Android Code Review
6 changed files with 7 additions and 5 deletions

View File

@@ -87,7 +87,7 @@ EglConfig* pixelFormatToConfig(EGLNativeDisplayType dpy,int renderableType,EGLNa
int bSize,red,green,blue,alpha,depth,stencil; int bSize,red,green,blue,alpha,depth,stencil;
int supportedSurfaces,visualType,visualId; int supportedSurfaces,visualType,visualId;
int caveat,transparentType,samples; int caveat,transparentType,samples;
int tRed,tGreen,tBlue; int tRed=0,tGreen=0,tBlue=0;
int pMaxWidth,pMaxHeight,pMaxPixels; int pMaxWidth,pMaxHeight,pMaxPixels;
int tmp; int tmp;
int configId,level,renderable; int configId,level,renderable;

View File

@@ -22,7 +22,7 @@ class EglDisplay;
class GLEScontext; class GLEScontext;
struct ThreadInfo { struct ThreadInfo {
ThreadInfo():glesContext(NULL),objManager(NULL){} ThreadInfo():eglDisplay(NULL),glesContext(NULL),objManager(NULL){}
void updateInfo(ContextPtr eglctx, void updateInfo(ContextPtr eglctx,
EglDisplay* dpy, EglDisplay* dpy,

View File

@@ -36,6 +36,7 @@ FramebufferData::FramebufferData(GLuint name):m_dirty(false) {
m_attachPoints[i].target = 0; m_attachPoints[i].target = 0;
m_attachPoints[i].name = 0; m_attachPoints[i].name = 0;
m_attachPoints[i].obj = ObjectDataPtr(NULL); m_attachPoints[i].obj = ObjectDataPtr(NULL);
m_attachPoints[i].owned = false;
} }
} }

View File

@@ -97,7 +97,7 @@ void doCompressedTexImage2D(GLEScontext * ctx, GLenum target, GLint level,
glTexImage2DPtr(target,i,uncompressedFrmt,tmpWidth,tmpHeight,border,uncompressedFrmt,GL_UNSIGNED_BYTE,uncompressed); glTexImage2DPtr(target,i,uncompressedFrmt,tmpWidth,tmpHeight,border,uncompressedFrmt,GL_UNSIGNED_BYTE,uncompressed);
tmpWidth/=2; tmpWidth/=2;
tmpHeight/=2; tmpHeight/=2;
delete uncompressed; delete[] uncompressed;
} }
} }
break; break;

View File

@@ -183,7 +183,7 @@ InitConfigStatus FBConfig::initConfigList(FrameBuffer *fb)
} }
s_numConfigs = j; s_numConfigs = j;
delete configs; delete[] configs;
return ret; return ret;
} }
@@ -303,6 +303,7 @@ FBConfig::FBConfig(EGLDisplay p_eglDpy, EGLConfig p_eglCfg)
m_eglConfig = p_eglCfg; m_eglConfig = p_eglCfg;
m_attribValues = new GLint[s_numConfigAttribs]; m_attribValues = new GLint[s_numConfigAttribs];
for (int i=0; i<s_numConfigAttribs; i++) { for (int i=0; i<s_numConfigAttribs; i++) {
m_attribValues[i] = 0;
s_egl.eglGetConfigAttrib(p_eglDpy, p_eglCfg, s_configAttribs[i], &m_attribValues[i]); s_egl.eglGetConfigAttrib(p_eglDpy, p_eglCfg, s_configAttribs[i], &m_attribValues[i]);
// //

View File

@@ -36,7 +36,7 @@ ReadBuffer::~ReadBuffer()
int ReadBuffer::getData() int ReadBuffer::getData()
{ {
if ((m_validData > 0) && (m_readPtr > m_buf)) { if ((m_validData > 0) && (m_readPtr > m_buf)) {
memcpy(m_buf, m_readPtr, m_validData); memmove(m_buf, m_readPtr, m_validData);
} }
// get fresh data into the buffer; // get fresh data into the buffer;
size_t len = m_size - m_validData; size_t len = m_size - m_validData;