OSDN Git Service

Fix thread-local storage memory leak.
authorNicolas Capens <capn@google.com>
Tue, 5 Sep 2017 18:06:06 +0000 (14:06 -0400)
committerNicolas Capens <nicolascapens@google.com>
Tue, 5 Sep 2017 18:18:52 +0000 (18:18 +0000)
eglReleaseThread() was leaking some memory because even though it
deletes the 'current' thread state, it was inadvertently getting
re-allocated when recording the success error state.

Change-Id: I92efb1b34e62a21998b4fc19aaeba6473b06548b
Reviewed-on: https://swiftshader-review.googlesource.com/11968
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/libEGL/libEGL.cpp

index 3a62da0..21ef933 100644 (file)
@@ -488,7 +488,7 @@ EGLBoolean ReleaseThread(void)
 
        detachThread();
 
-       return success(EGL_TRUE);
+       return EGL_TRUE;   // success() is not called here because it would re-allocate thread-local storage.
 }
 
 EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)