diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 330cf0ddf0b..5b8aeb4be20 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -541,6 +541,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment shmget has failed: %s", strerror(errno)); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -550,6 +552,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment shmat has failed: %s", strerror(errno)); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -570,6 +574,9 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment XShmAttach has failed: %s", strerror(errno)); + shmdt(shminfo->shmaddr); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -1345,13 +1352,10 @@ void X11SD_DisposeXImage(XImage * image) { #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); } }