jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
changeset 12170 bdd7741e16de
parent 11093 e753252dc8a9
child 12171 ab7bb1fd211f
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Wed Jul 05 18:04:46 2017 +0200
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Mon Mar 12 13:30:16 2012 +0800
@@ -540,6 +540,8 @@
         J2dRlsTraceLn1(J2D_TRACE_ERROR,
                        "X11SD_SetupSharedSegment shmget has failed: %s",
                        strerror(errno));
+        free((void *)shminfo);
+        XDestroyImage(img);
         return NULL;
     }
 
@@ -549,6 +551,8 @@
         J2dRlsTraceLn1(J2D_TRACE_ERROR,
                        "X11SD_SetupSharedSegment shmat has failed: %s",
                        strerror(errno));
+        free((void *)shminfo);
+        XDestroyImage(img);
         return NULL;
     }
 
@@ -569,6 +573,9 @@
         J2dRlsTraceLn1(J2D_TRACE_ERROR,
                        "X11SD_SetupSharedSegment XShmAttach has failed: %s",
                        strerror(errno));
+        shmdt(shminfo->shmaddr);
+        free((void *)shminfo);
+        XDestroyImage(img);
         return NULL;
     }
 
@@ -1344,13 +1351,10 @@
 #ifdef MITSHM
         if (image->obdata != NULL) {
             X11SD_DropSharedSegment((XShmSegmentInfo*)image->obdata);
-        } else {
-            free(image->data);
+            image->obdata = NULL;
         }
-#else
-        free(image->data);
 #endif /* MITSHM */
-        XFree(image);
+        XDestroyImage(image);
     }
 }