Title: [104395] trunk/Source/WebCore
Revision
104395
Author
dba...@webkit.org
Date
2012-01-07 19:41:45 -0800 (Sat, 07 Jan 2012)

Log Message

Memory allocator mismatch; Use operator new[] with OwnArrayPtr instead of fastMalloc()

Rubber-stamped by Adam Barth.

Currently getProgramInfoLog() in GraphicsContext3DOpenGL.cpp assumes that operator new[]
and fastMalloc() are equivalent when it adopts a fastMalloc() allocated buffer. Notice,
OwnArrayPtr ultimately calls delete[] on destruction. When GLOBAL_FASTMALLOC_NEW is disabled,
it isn't true that operator new[], operator delete[] are equivalent to fastMalloc(), fastFree(),
respectively. Hence, there may be a mismatch between the allocation and deallocation
routines. Therefore, we should allocate the array to be adopted by OwnArrayPtr using
operator new[].

* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::getProgramInfoLog):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104394 => 104395)


--- trunk/Source/WebCore/ChangeLog	2012-01-08 00:45:55 UTC (rev 104394)
+++ trunk/Source/WebCore/ChangeLog	2012-01-08 03:41:45 UTC (rev 104395)
@@ -1,3 +1,20 @@
+2012-01-07  Daniel Bates  <dba...@webkit.org>
+
+        Memory allocator mismatch; Use operator new[] with OwnArrayPtr instead of fastMalloc()
+
+        Rubber-stamped by Adam Barth.
+
+        Currently getProgramInfoLog() in GraphicsContext3DOpenGL.cpp assumes that operator new[]
+        and fastMalloc() are equivalent when it adopts a fastMalloc() allocated buffer. Notice,
+        OwnArrayPtr ultimately calls delete[] on destruction. When GLOBAL_FASTMALLOC_NEW is disabled,
+        it isn't true that operator new[], operator delete[] are equivalent to fastMalloc(), fastFree(),
+        respectively. Hence, there may be a mismatch between the allocation and deallocation
+        routines. Therefore, we should allocate the array to be adopted by OwnArrayPtr using
+        operator new[].
+
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::getProgramInfoLog):
+
 2012-01-07  Chris Marrin  <cmar...@apple.com>
 
         Fixed ANGLE build for GNU and QT broken in https://trac.webkit.org/changeset/104363

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (104394 => 104395)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-01-08 00:45:55 UTC (rev 104394)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-01-08 03:41:45 UTC (rev 104395)
@@ -1248,7 +1248,7 @@
         return String(); 
 
     GLsizei size = 0;
-    OwnArrayPtr<GLchar> info = adoptArrayPtr(static_cast<GLchar*>(fastMalloc(length)));
+    OwnArrayPtr<GLchar> info = adoptArrayPtr(new GLchar[length]);
     ::glGetProgramInfoLog(program, length, &size, info.get());
 
     return String(info.get());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to