summaryrefslogtreecommitdiff
path: root/xcompmgr.c
diff options
context:
space:
mode:
authordolio <dolio>2004-09-23 01:56:00 +0000
committerdolio <dolio>2004-09-23 01:56:00 +0000
commit4d85ae8dbc4dbe75cef71f1280cea4ee15a1b6d7 (patch)
treeb0ca1a70e5ee9973a4b2c3d8464527da818a049a /xcompmgr.c
parent26fd15f06be3911ebf53c0a3014d406761db84cf (diff)
Miscellaneous code cleanup and failed allocation checks.
Diffstat (limited to 'xcompmgr.c')
-rw-r--r--xcompmgr.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/xcompmgr.c b/xcompmgr.c
index dcb0843..01d9188 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -348,7 +348,7 @@ run_fades (Display *dpy)
{
w->opacity = f->finish*OPAQUE;
dequeue_fade (dpy, f);
- }
+ }
}
else
{
@@ -356,7 +356,7 @@ run_fades (Display *dpy)
{
w->opacity = f->finish*OPAQUE;
dequeue_fade (dpy, f);
- }
+ }
}
determine_mode (dpy, w);
if (w->shadow)
@@ -677,11 +677,20 @@ solid_picture (Display *dpy, Bool argb, double a, double r, double g, double b)
XRenderColor c;
pixmap = XCreatePixmap (dpy, root, 1, 1, argb ? 32 : 8);
+ if (!pixmap)
+ return None;
+
pa.repeat = True;
picture = XRenderCreatePicture (dpy, pixmap,
XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8),
CPRepeat,
&pa);
+ if (!picture)
+ {
+ XFreePixmap (dpy, pixmap);
+ return None;
+ }
+
c.alpha = a * 0xffff;
c.red = r * 0xffff;
c.green = g * 0xffff;
@@ -1257,7 +1266,7 @@ get_opacity_prop(Display *dpy, win *w, unsigned int def)
int result = XGetWindowProperty(dpy, w->id, opacityAtom, 0L, 1L, False,
XA_CARDINAL, &actual, &format,
&n, &left, &data);
- if (result == Success && data != None)
+ if (result == Success && data != NULL)
{
unsigned int i;
memcpy (&i, data, sizeof (unsigned int));
@@ -1360,7 +1369,7 @@ static Atom
determine_wintype (Display *dpy, Window w)
{
Window root_return, parent_return;
- Window *children;
+ Window *children = NULL;
unsigned int nchildren, i;
Atom type;
@@ -1372,6 +1381,8 @@ determine_wintype (Display *dpy, Window w)
&nchildren))
{
/* XQueryTree failed. */
+ if (children)
+ XFree ((void *)children);
return winNormalAtom;
}
@@ -1382,6 +1393,9 @@ determine_wintype (Display *dpy, Window w)
return type;
}
+ if (children)
+ XFree ((void *)children);
+
return winNormalAtom;
}
@@ -1553,6 +1567,9 @@ circulate_win (Display *dpy, XCirculateEvent *ce)
win *w = find_win (dpy, ce->window);
Window new_above;
+ if (!w)
+ return;
+
if (ce->place == PlaceOnTop)
new_above = list->id;
else