about summary refs log tree commit diff
path: root/xutil.c
diff options
context:
space:
mode:
authorokan <okan>2015-03-29 00:21:05 +0000
committerokan <okan>2015-03-29 00:21:05 +0000
commitbc21e4aa37b36b486f7f6ddcb6050e2be93590c1 (patch)
treeda1b2c2fff822dbb33ab2c7b2692cb7599796d03 /xutil.c
parent668da8493abd2abb6242a0a707e4d745c01b1031 (diff)
parent557cd382dcd973fd96605c3359e3d6dfa45a4fd9 (diff)
downloadcwm-bc21e4aa37b36b486f7f6ddcb6050e2be93590c1.tar.gz
cwm-bc21e4aa37b36b486f7f6ddcb6050e2be93590c1.tar.xz
cwm-bc21e4aa37b36b486f7f6ddcb6050e2be93590c1.zip
cvsimport
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/xutil.c b/xutil.c
index 71547a0..5294edc 100644
--- a/xutil.c
+++ b/xutil.c
@@ -220,7 +220,7 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
 	if (i == 0)
 		return;
 
-	winlist = xcalloc(i, sizeof(*winlist));
+	winlist = xreallocarray(NULL, i, sizeof(*winlist));
 	TAILQ_FOREACH(cc, &sc->clientq, entry)
 		winlist[j++] = cc->win;
 	XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST],
@@ -320,7 +320,7 @@ xu_ewmh_net_desktop_names(struct screen_ctx *sc)
 
 	TAILQ_FOREACH(gc, &sc->groupq, entry)
 		len += strlen(gc->name) + 1;
-	q = p = xcalloc(len, sizeof(*p));
+	q = p = xreallocarray(NULL, len, sizeof(*p));
 
 	tlen = len;
 	TAILQ_FOREACH(gc, &sc->groupq, entry) {
@@ -332,6 +332,7 @@ xu_ewmh_net_desktop_names(struct screen_ctx *sc)
 
 	XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_DESKTOP_NAMES],
 	    cwmh[UTF8_STRING], 8, PropModeReplace, (unsigned char *)p, len);
+	free(p);
 }
 
 /* Application Window Properties */
@@ -356,7 +357,7 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n)
 	    (unsigned char **)&p)) <= 0)
 		return(NULL);
 
-	state = xcalloc(*n, sizeof(Atom));
+	state = xreallocarray(NULL, *n, sizeof(Atom));
 	(void)memcpy(state, p, *n * sizeof(Atom));
 	XFree((char *)p);
 
@@ -443,7 +444,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 = xcalloc((n + _NET_WM_STATES_NITEMS), sizeof(Atom));
+	atoms = xreallocarray(NULL, (n + _NET_WM_STATES_NITEMS), sizeof(Atom));
 	for (i = j = 0; i < n; i++) {
 		if (oatoms[i] != ewmh[_NET_WM_STATE_STICKY] &&
 		    oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] &&