8005261: [parfait] #415 sun/java2d/opengl/GLXSurfaceData.c Memory leak of pointer 'glxsdo' allocated with malloc

Reviewed-by: prr, vadim
This commit is contained in:
Jia-Hong Chen 2013-02-08 11:36:18 -08:00 committed by Jennifer Godinez
parent 410876d0ee
commit c3e1c6d07b

View File

@ -57,22 +57,23 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd,
jobject peer, jlong aData)
{
#ifndef HEADLESS
OGLSDOps *oglsdo = (OGLSDOps *)SurfaceData_InitOps(env, glxsd,
sizeof(OGLSDOps));
GLXSDOps *glxsdo = (GLXSDOps *)malloc(sizeof(GLXSDOps));
J2dTraceLn(J2D_TRACE_INFO, "GLXSurfaceData_initOps");
if (oglsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return;
}
if (glxsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "creating native GLX ops");
return;
}
OGLSDOps *oglsdo = (OGLSDOps *)SurfaceData_InitOps(env, glxsd,
sizeof(OGLSDOps));
if (oglsdo == NULL) {
free(glxsdo);
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return;
}
J2dTraceLn(J2D_TRACE_INFO, "GLXSurfaceData_initOps");
oglsdo->privOps = glxsdo;
oglsdo->sdOps.Lock = OGLSD_Lock;