From: dolio Date: Fri, 17 Sep 2004 05:20:35 +0000 (+0000) Subject: Added allocation failure checks in shadow_picture and caused it to exit X-Git-Tag: XCOMPMGR_1_1_2~11 X-Git-Url: http://git.openbox.org/?p=dana%2Fxcompmgr.git;a=commitdiff_plain;h=ed88a4746832f69e65d866d732eadb2070456806 Added allocation failure checks in shadow_picture and caused it to exit gracefully rather than writing to unallocated memory. --- diff --git a/ChangeLog b/ChangeLog index 467e608..556f0f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-09-17 Dan Doel + + * xcompmgr.c: (shadow_picture): + Added some tests to check for failed pixmap/picture/gc allocations and + exit appropriately. + 2004-09-14 Adam Jackson * xcompmgr.c: diff --git a/xcompmgr.c b/xcompmgr.c index 7e542fe..3d27786 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -581,10 +581,30 @@ shadow_picture (Display *dpy, double opacity, Picture alpha_pict, int width, int shadowImage->width, shadowImage->height, 8); + if (!shadowPixmap) + { + XDestroyImage (shadowImage); + return None; + } + shadowPicture = XRenderCreatePicture (dpy, shadowPixmap, XRenderFindStandardFormat (dpy, PictStandardA8), 0, 0); + if (!shadowPicture) + { + XDestroyImage (shadowImage); + XFreePixmap (dpy, shadowPixmap); + return None; + } + gc = XCreateGC (dpy, shadowPixmap, 0, 0); + if (!gc) + { + XDestroyImage (shadowImage); + XFreePixmap (dpy, shadowPixmap); + XRenderFreePicture (dpy, shadowPicture); + return None; + } XPutImage (dpy, shadowPixmap, gc, shadowImage, 0, 0, 0, 0, shadowImage->width,