about summary refs log tree commit diff
path: root/xutil.c
diff options
context:
space:
mode:
authorokan <okan>2013-07-10 14:15:58 +0000
committerokan <okan>2013-07-10 14:15:58 +0000
commit93bfc4a5c14db580a426571b8be6011998189ad2 (patch)
treea14fb69b67091ef2e2b753dc53f60854b0b58e74 /xutil.c
parentba9baaf671a4054524f62a5b90b21f603c369a5b (diff)
parentbd7b8163bb0be2bd4904a179771a8f79163e8161 (diff)
downloadcwm-93bfc4a5c14db580a426571b8be6011998189ad2.tar.gz
cwm-93bfc4a5c14db580a426571b8be6011998189ad2.tar.xz
cwm-93bfc4a5c14db580a426571b8be6011998189ad2.zip
cvsimport
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xutil.c b/xutil.c
index 7145683..c1e4611 100644
--- a/xutil.c
+++ b/xutil.c
@@ -291,7 +291,7 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
 	if (i == 0)
 		return;
 
-	winlist = xmalloc(i * sizeof(*winlist));
+	winlist = xcalloc(i, sizeof(*winlist));
 	TAILQ_FOREACH(cc, &Clientq, entry)
 		winlist[j++] = cc->win;
 	XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST].atom,
@@ -382,7 +382,7 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n)
 	    (u_char **)&p)) <= 0)
 		return (NULL);
 
-	state = xmalloc(*n * sizeof(Atom));
+	state = xcalloc(*n, sizeof(Atom));
 	memcpy(state, p, *n * sizeof(Atom));
 	XFree((char *)p);
 
@@ -393,7 +393,7 @@ void
 xu_ewmh_handle_net_wm_state_msg(struct client_ctx *cc, int action,
     Atom first, Atom second)
 {
-	int i;
+	u_int i;
 	static struct handlers {
 		int atom;
 		int property;
@@ -449,7 +449,7 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
 	int	 n, i, j;
 
 	oatoms = xu_ewmh_get_net_wm_state(cc, &n);
-	atoms = xmalloc((n + _NET_WM_STATES_NITEMS) * sizeof(Atom));
+	atoms = xcalloc((n + _NET_WM_STATES_NITEMS), sizeof(Atom));
 	for (i = j = 0; i < n; i++) {
 		if (oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ].atom &&
 		    oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_VERT].atom)