diff options
author | dolio <dolio> | 2004-09-17 05:20:35 +0000 |
---|---|---|
committer | dolio <dolio> | 2004-09-17 05:20:35 +0000 |
commit | ed88a4746832f69e65d866d732eadb2070456806 (patch) | |
tree | 00a906c1ee72591fd4a7405de31470e5de010d85 /xcompmgr.c | |
parent | Bug #1360: Fix a segfault by checking the return value of XQueryTree. (diff) | |
download | xcman-ed88a4746832f69e65d866d732eadb2070456806.tar.gz xcman-ed88a4746832f69e65d866d732eadb2070456806.tar.bz2 xcman-ed88a4746832f69e65d866d732eadb2070456806.tar.xz |
Added allocation failure checks in shadow_picture and caused it to exit
gracefully rather than writing to unallocated memory.
Diffstat (limited to 'xcompmgr.c')
-rw-r--r-- | xcompmgr.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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, |