rem: free(map);
add: wfree(map);
context: PlaceIcon(WScreen *scr, int *x_ret, int *y_ret){    int pf;			       /* primary axis */    int sf;			       /* secondary axis */    int fullW;    int fullH;    char *map;    int pi, si;    WCoreWindow *obj;    int sx1, sx2, sy1, sy2;	       /* screen boundary */    int sw, sh;    int xo, yo;    int xs, ys;    int x, y;    int isize = wPreferences.icon_size;    int done = 0;    WMBagIterator iter;    /*     * Find out screen boundaries.     */    sx1 = 0;    sy1 = 0;    sx2 = scr->scr_width;    sy2 = scr->scr_height;    if (scr->dock) {	if (scr->dock->on_right_side)            sx2 -= isize + DOCK_EXTRA_SPACE;	else	    sx1 += isize + DOCK_EXTRA_SPACE;    }    sw = isize * (scr->scr_width/isize);    sh = isize * (scr->scr_height/isize);    fullW = (sx2-sx1)/isize;    fullH = (sy2-sy1)/isize;    /* icon yard boundaries */        if (wPreferences.icon_yard & IY_VERT) {	pf = fullH;	sf = fullW;    } else {	pf = fullW;	sf = fullH;    }    if (wPreferences.icon_yard & IY_RIGHT) {	xo = sx2 - isize;	xs = -1;    } else {	xo = sx1;	xs = 1;    }    if (wPreferences.icon_yard & IY_TOP) {	yo = sy1;	ys = 1;    } else {	yo = sy2 - isize;	ys = -1;    }    /*     * Create a map with the occupied slots. 1 means the slot is used     * or at least partially used.      * The slot usage can be optimized by only marking fully used slots     * or slots that have most of it covered.      * Space usage is worse than the fvwm algorithm (used in the old version)     * but complexity is much better (faster) than it.     */    map = wmalloc((sw+2) * (sh+2));    memset(map, 0, (sw+2) * (sh+2));#define INDEX(x,y)	(((y)+1)*(sw+2) + (x) + 1)    WM_ETARETI_BAG(scr->stacking_list, obj, iter) {	while (obj) {	    int x, y;	    if (iconPosition(obj, sx1, sy1, sx2, sy2, scr->current_workspace, 			     &x, &y)) {		int xdi, ydi;	       /* rounded down */		int xui, yui;	       /* rounded up */		xdi = x/isize;		ydi = y/isize;		xui = (x+isize/2)/isize;		yui = (y+isize/2)/isize;		map[INDEX(xdi,ydi)] = 1;		map[INDEX(xdi,yui)] = 1;		map[INDEX(xui,ydi)] = 1;		map[INDEX(xui,yui)] = 1;	    }	    obj = obj->stacking->under;	}    }    /*     * Default position     */    *x_ret = 0;    *y_ret = 0;    /*     * Look for an empty slot     */    for (si=0; si<sf; si++) {	for (pi=0; pi<pf; pi++) {	    if (wPreferences.icon_yard & IY_VERT) {		x = xo + xs*(si*isize);		y = yo + ys*(pi*isize);	    } else {		x = xo + xs*(pi*isize);		y = yo + ys*(si*isize);	    }	    if (!map[INDEX(x/isize, y/isize)]) {		*x_ret = x;		*y_ret = y;		done = 1;		break;	    }	}	if (done)	    break;    }    free(map);}