From 50e4ce05521b0d95890e894691819882113aae86 Mon Sep 17 00:00:00 2001 From: "tomhudson@google.com" Date: Tue, 19 Jun 2012 15:27:50 +0000 Subject: [PATCH] Fix memory leaks. http://codereview.appspot.com/6301098/ git-svn-id: http://skia.googlecode.com/svn/trunk@4281 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/gpu/GrSamplerState.h | 3 +-- src/gpu/gl/GrGpuGL_program.cpp | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h index f8ad1c0715..1f81afad5e 100644 --- a/include/gpu/GrSamplerState.h +++ b/include/gpu/GrSamplerState.h @@ -81,8 +81,7 @@ public: fSwapRAndB = s.fSwapRAndB; fTextureDomain = s.fTextureDomain; - fCustomStage = s.fCustomStage; - SkSafeRef(fCustomStage); + GrSafeAssign(fCustomStage, s.fCustomStage); return *this; } diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 97f9b6d817..f8d71ffbf4 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -86,7 +86,10 @@ void GrGpuGL::DeleteProgram(const GrGLInterface* gl, } GR_GL_CALL(gl, DeleteShader(programData->fFShaderID)); GR_GL_CALL(gl, DeleteProgram(programData->fProgramID)); - GR_DEBUGCODE(memset(programData, 0, sizeof(*programData));) + GR_DEBUGCODE(programData->fVShaderID = 0); + GR_DEBUGCODE(programData->fGShaderID = 0); + GR_DEBUGCODE(programData->fFShaderID = 0); + GR_DEBUGCODE(programData->fProgramID = 0); } ////////////////////////////////////////////////////////////////////////////////