rem: free(tmp);
add: wfree(tmp);
context: wClientCheckProperty(WWindow *wwin, XPropertyEvent *event) {    XWindowAttributes attribs;    XWMHints *new_hints;    int i, g1, g2;    char *tmp;        switch (event->atom) {     case XA_WM_NAME:	/* window title was changed */	wwin->flags.wm_name_changed = 1;	if (wwin->frame) {	    if (!wFetchName(dpy, wwin->client_win, &tmp)) {		/* the hint was removed */		tmp = wstrdup(DEF_WINDOW_TITLE);#ifdef KWM_HINTS		wKWMSendEventMessage(wwin, WKWMChangedClient);#endif	    }            if (wFrameWindowChangeTitle(wwin->frame, tmp)) {                /* only update the menu if the title has actually changed */                UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);#ifdef KWM_HINTS		wKWMSendEventMessage(wwin, WKWMChangedClient);#endif            }	    if (tmp)		free(tmp);	}	break;	     case XA_WM_ICON_NAME:#ifdef KWM_HINTS	wKWMSendEventMessage(wwin, WKWMChangedClient);#endif	if (!wwin->icon) 	    break;	else {	    char *new_title;	    	    /* icon title was changed */	    wGetIconName(dpy, wwin->client_win, &new_title);	    wIconChangeTitle(wwin->icon, new_title);	}	break;	     case XA_WM_COMMAND:	if (wwin->main_window!=None) {	    WApplication *wapp = wApplicationOf(wwin->main_window);	    char **argv;	    int argc;	    if (wapp && wapp->app_icon) {		if (wapp->app_icon->command!=NULL)		    free(wapp->app_icon->command);		if (XGetCommand(dpy, wwin->main_window, &argv, &argc)) {		    if (argc > 0 && argv != NULL)			wapp->app_icon->command = FlattenStringList(argv,argc);		    if (argv) {			XFreeStringList(argv);		    }		}	    }	}	break;	     case XA_WM_HINTS:	/* WM_HINTS */	new_hints = XGetWMHints(dpy, wwin->client_win);		/* group leader update	 * 	 * This means that the window is setting the leader after	 * it was mapped, changing leaders or removing the leader.	 * 	 * Valid state transitions are:	 *	 *          _1            __2	 *         / \           /  \	 *         v |           v  |	 *         (GC)         (GC')	 *        /  ^          /   ^	 *       3|  |4        5|   |6	 *        |  |          |   |	 *        v  /          v   /	 *        (G'C)        (G'C')	 * 	 * Where G is the window_group hint, C is CLIENT_LEADER property	 * and ' indicates the hint is unset.	 *	 * 1,2 - change group leader to new value of window_group	 * 3 - change leader to value of CLIENT_LEADER	 * 4 - change leader to value of window_group	 * 5 - destroy application	 * 6 - create application	 */	if (new_hints && (new_hints->flags & WindowGroupHint)	    && new_hints->window_group!=None) {	    g2 = 1;	} else {	    g2 = 0;	}	if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)	    && wwin->wm_hints->window_group!=None) {	    g1 = 1;	} else {	    g1 = 0;	}		if (wwin->client_leader) {	    if (g1 && g2 		&& wwin->wm_hints->window_group!=new_hints->window_group) {		i = 1;	    } else if (g1 && !g2) {		i = 3;	    } else if (!g1 && g2) {		i = 4;	    } else {		i = 0;	    }	} else {	    if (g1 && g2 		&& wwin->wm_hints->window_group!=new_hints->window_group) {		i = 2;	    } else if (g1 && !g2) {		i = 5;	    } else if (!g1 && g2) {		i = 6;	    } else {		i = 0;	    }	}		if (wwin->wm_hints)	  XFree(wwin->wm_hints);	wwin->wm_hints = new_hints;	/* do action according to state transition */	switch (i) {	    	 /* 3 - change leader to value of CLIENT_LEADER */	 case 3:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = wwin->client_leader;	    wwin->group_id = None;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;	 /* 1,2,4 - change leader to new value of window_group */	 case 1:	 case 2:	 case 4:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = new_hints->window_group;	    wwin->group_id = wwin->main_window;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;	    	 /* 5 - destroy application */	 case 5:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = None;	    wwin->group_id = None;	    break;	    	 /* 6 - create application */	 case 6:	    wwin->main_window = new_hints->window_group;	    wwin->group_id = wwin->main_window;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;	}#ifdef DEBUG	if (i) {	    printf("window leader update caused state transition %i\n",i);	}#endif	if (wwin->wm_hints) {	    /* update icon */	    if ((wwin->wm_hints->flags & IconPixmapHint)		|| (wwin->wm_hints->flags & IconWindowHint)) {		WApplication *wapp;		if (wwin->flags.miniaturized && wwin->icon) {		    wIconUpdate(wwin->icon);		}		wapp = wApplicationOf(wwin->main_window);		if (wapp && wapp->app_icon) {		    wIconUpdate(wapp->app_icon->icon);		}#ifdef KWM_HINTS		wKWMSendEventMessage(wwin, WKWMIconChange);#endif	    }	    if (wwin->wm_hints->flags & UrgencyHint)	      wwin->flags.urgent = 1;	    else	      wwin->flags.urgent = 0;	} else {	    wwin->group_id = None;	}	break;	     case XA_WM_NORMAL_HINTS:	/* normal (geometry) hints */	{	    int foo;	    unsigned bar;	    XGetWindowAttributes(dpy, wwin->client_win, &attribs);	    wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,				  &bar, &bar);	    /* TODO: should we check for consistency of the current	     * size against the new geometry hints? */	}	break;	     case XA_WM_TRANSIENT_FOR:	{	    Window new_owner;	    WWindow *owner;	    	    if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {		new_owner = None;	    } else {		if (new_owner==0 || new_owner == wwin->client_win) {		    new_owner = wwin->screen_ptr->root_win;		}	    }	    if (new_owner!=wwin->transient_for) {		owner = wWindowFor(wwin->transient_for);		if (owner) {		    if (owner->flags.semi_focused) {			owner->flags.semi_focused = 0;			if ((owner->flags.mapped || owner->flags.shaded)			    && owner->frame)			  wFrameWindowPaint(owner->frame);		    }		}		owner = wWindowFor(new_owner);		if (owner) {		    if (!owner->flags.semi_focused) {			owner->flags.semi_focused = 1;			if ((owner->flags.mapped || owner->flags.shaded)			    && owner->frame)			  wFrameWindowPaint(owner->frame);		    }		}		wwin->transient_for = new_owner;		if (new_owner==None) {		    if (WFLAGP(wwin, no_miniaturizable)) {			WSETUFLAG(wwin, no_miniaturizable, 0);			WSETUFLAG(wwin, no_miniaturize_button, 0);			if (wwin->frame)			    wWindowConfigureBorders(wwin);		    }		} else if (!WFLAGP(wwin, no_miniaturizable)) {		    WSETUFLAG(wwin, no_miniaturizable, 1);		    WSETUFLAG(wwin, no_miniaturize_button, 1);		    if (wwin->frame)			wWindowConfigureBorders(wwin);		}	    }	}	break;	     default:	if (event->atom==_XA_WM_PROTOCOLS) {	    PropGetProtocols(wwin->client_win, &wwin->protocols);	    WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);	    if (wwin->frame)		wWindowUpdateButtonImages(wwin);	} else if (event->atom==_XA_WM_COLORMAP_WINDOWS) {	    	    GetColormapWindows(wwin);	    wColormapInstallForWindow(wwin->screen_ptr, wwin);	} else if (event->atom==_XA_WINDOWMAKER_MENU) {	    WApplication *wapp;	    wapp = wApplicationOf(wwin->main_window);	    if (wapp) {		if (wapp->menu) {		    /* update menu */		    /* TODO: remake appmenu update */		    wAppMenuDestroy(wapp->menu);		}		wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);		/* make the appmenu be mapped */		wSetFocusTo(wwin->screen_ptr, NULL);		wSetFocusTo(wwin->screen_ptr, 			    wwin->screen_ptr->focused_window);	    }	} else if (event->atom==_XA_GNUSTEP_WM_ATTR) {	    GNUstepWMAttributes *attr;	    PropGetGNUstepWMAttr(wwin->client_win, &attr);	    	    wWindowUpdateGNUstepAttr(wwin, attr);	    	    XFree(attr);	} else {#ifdef KWM_HINTS	    Bool done;	    done = wKWMCheckClientHintChange(wwin, event);#endif /* KWM_HINTS */	}    }}