changeset 2516:e03065fc64e7

6959998: Return of SurfaceData_InitOps point not checked in all cases (parfait found these) Reviewed-by: prr Contributed-by: ohair <kelly.ohair@oracle.com>
author igor
date Mon, 12 Jul 2010 13:16:28 -0700
parents ab55cb957830
children 2ad69cb576b4
files src/share/native/sun/awt/image/BufImgSurfaceData.c src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c src/solaris/native/sun/java2d/x11/X11SurfaceData.c src/windows/native/sun/java2d/opengl/WGLSurfaceData.c src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.cpp
diffstat 5 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/image/BufImgSurfaceData.c	Tue Jul 06 18:23:14 2010 -0700
+++ b/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/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c	Tue Jul 06 18:23:14 2010 -0700
+++ b/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/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Jul 06 18:23:14 2010 -0700
+++ b/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/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c	Tue Jul 06 18:23:14 2010 -0700
+++ b/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/src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.cpp	Tue Jul 06 18:23:14 2010 -0700
+++ b/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;