Added allocation failure checks in shadow_picture and caused it to exit
gracefully rather than writing to unallocated memory.
This commit is contained in:
parent
7abdf973ea
commit
ed88a47468
|
@ -1,3 +1,9 @@
|
||||||
|
2004-09-17 Dan Doel <dolio@case.edu>
|
||||||
|
|
||||||
|
* xcompmgr.c: (shadow_picture):
|
||||||
|
Added some tests to check for failed pixmap/picture/gc allocations and
|
||||||
|
exit appropriately.
|
||||||
|
|
||||||
2004-09-14 Adam Jackson <ajax@freedesktop.org>
|
2004-09-14 Adam Jackson <ajax@freedesktop.org>
|
||||||
|
|
||||||
* xcompmgr.c:
|
* xcompmgr.c:
|
||||||
|
|
20
xcompmgr.c
20
xcompmgr.c
|
@ -581,10 +581,30 @@ shadow_picture (Display *dpy, double opacity, Picture alpha_pict, int width, int
|
||||||
shadowImage->width,
|
shadowImage->width,
|
||||||
shadowImage->height,
|
shadowImage->height,
|
||||||
8);
|
8);
|
||||||
|
if (!shadowPixmap)
|
||||||
|
{
|
||||||
|
XDestroyImage (shadowImage);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
shadowPicture = XRenderCreatePicture (dpy, shadowPixmap,
|
shadowPicture = XRenderCreatePicture (dpy, shadowPixmap,
|
||||||
XRenderFindStandardFormat (dpy, PictStandardA8),
|
XRenderFindStandardFormat (dpy, PictStandardA8),
|
||||||
0, 0);
|
0, 0);
|
||||||
|
if (!shadowPicture)
|
||||||
|
{
|
||||||
|
XDestroyImage (shadowImage);
|
||||||
|
XFreePixmap (dpy, shadowPixmap);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
gc = XCreateGC (dpy, shadowPixmap, 0, 0);
|
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,
|
XPutImage (dpy, shadowPixmap, gc, shadowImage, 0, 0, 0, 0,
|
||||||
shadowImage->width,
|
shadowImage->width,
|
||||||
|
|
Loading…
Reference in New Issue