Bug 662649. DrawFPS: free leaked buffer. r=joe
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 22 Jun 2011 14:43:52 -0400
changeset 71868 5ec97825b29b88577f305d094d1c0715b192b549
parent 71867 17f2489e16604e9b21e31734f6b534f05ba2b84f
child 71869 f46f26308ec8ea55150cc7185835d0af64db7e43
push id209
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:42:16 +0000
treeherdermozilla-aurora@cc6e30cce8af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs662649
milestone7.0a1
Bug 662649. DrawFPS: free leaked buffer. r=joe glTexImage2D will keep a copy of this data around so we don't have to.
gfx/layers/opengl/LayerManagerOGL.cpp
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -575,16 +575,17 @@ LayerManagerOGL::FPSState::DrawFPS(GLCon
 
     unsigned long* buf = (unsigned long*)malloc(64 * 8 * 4);
     for (int i = 0; i < 7; i++) {
       for (int j = 0; j < 41; j++) {
         buf[i * 64 + j] = (text[i * 41 + j] == 0) ? 0xfff000ff : 0xffffffff;
       }
     }
     context->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA, 64, 8, 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, buf);
+    free(buf);
     initialized = true;
   }
 
   struct Vertex2D {
     float x,y;
   };
   const Vertex2D vertices[] = {
     { -1.0f, 1.0f - 42.f / viewport[3] },