6959998: Return of SurfaceData_InitOps point not checked in all cases (parfait found these)
Reviewed-by: prr
Contributed-by: ohair <kelly.ohair@oracle.com>
--- a/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c Tue Jul 06 18:23:14 2010 -0700
+++ b/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c Mon Jul 12 13:16:28 2010 -0700
@@ -111,6 +111,10 @@
{
BufImgSDOps *bisdo =
(BufImgSDOps*)SurfaceData_InitOps(env, bisd, sizeof(BufImgSDOps));
+ if (bisdo == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
+ return;
+ }
bisdo->sdOps.Lock = BufImg_Lock;
bisdo->sdOps.GetRasInfo = BufImg_GetRasInfo;
bisdo->sdOps.Release = BufImg_Release;
--- a/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c Tue Jul 06 18:23:14 2010 -0700
+++ b/jdk/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c Mon Jul 12 13:16:28 2010 -0700
@@ -65,6 +65,11 @@
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;
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Tue Jul 06 18:23:14 2010 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Mon Jul 12 13:16:28 2010 -0700
@@ -253,6 +253,10 @@
{
#ifndef HEADLESS
X11SDOps *xsdo = (X11SDOps*)SurfaceData_InitOps(env, xsd, sizeof(X11SDOps));
+ if (xsdo == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
+ return;
+ }
xsdo->sdOps.Lock = X11SD_Lock;
xsdo->sdOps.GetRasInfo = X11SD_GetRasInfo;
xsdo->sdOps.Unlock = X11SD_Unlock;
--- a/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c Tue Jul 06 18:23:14 2010 -0700
+++ b/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c Mon Jul 12 13:16:28 2010 -0700
@@ -66,6 +66,10 @@
J2dTraceLn(J2D_TRACE_INFO, "WGLSurfaceData_initOps");
+ if (oglsdo == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
+ return;
+ }
if (wglsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "creating native wgl ops");
return;
--- a/jdk/src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.cpp Tue Jul 06 18:23:14 2010 -0700
+++ b/jdk/src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.cpp Mon Jul 12 13:16:28 2010 -0700
@@ -363,6 +363,10 @@
{
J2dTraceLn(J2D_TRACE_INFO, "GDIWindowSurfaceData_initOps");
GDIWinSDOps *wsdo = (GDIWinSDOps *)SurfaceData_InitOps(env, wsd, sizeof(GDIWinSDOps));
+ if (wsdo == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
+ return;
+ }
wsdo->sdOps.Lock = GDIWinSD_Lock;
wsdo->sdOps.GetRasInfo = GDIWinSD_GetRasInfo;
wsdo->sdOps.Unlock = GDIWinSD_Unlock;