rem: free(wapp);
add: wfree(wapp);
context: wApplicationDestroy(WApplication *wapp){    Window main_window;    WWindow *wwin;    WScreen *scr;#ifdef REDUCE_APPICONS    unsigned int napps;#endif    if (!wapp)      return;      wapp->refcount--;    if (wapp->refcount>0)      return;    scr = wapp->main_window_desc->screen_ptr;    main_window = wapp->main_window;#ifdef REDUCE_APPICONS    napps = wAppIconReduceAppCount(wapp);#endif    if (wapp == scr->wapp_list) {        if (wapp->next)            wapp->next->prev = NULL;        scr->wapp_list = wapp->next;    } else {        if (wapp->next)            wapp->next->prev = wapp->prev;        if (wapp->prev)            wapp->prev->next = wapp->next;    }    XDeleteContext(dpy, wapp->main_window, wAppWinContext);    wAppMenuDestroy(wapp->menu);    if (wapp->app_icon) {        if (wapp->app_icon->docked && !wapp->app_icon->attracted) {#ifdef REDUCE_APPICONS	    if (napps == 0) {#endif		wapp->app_icon->running = 0;		/* since we keep it, we don't care if it was attracted or not */		wapp->app_icon->attracted = 0;		wapp->app_icon->icon->shadowed = 0;		wapp->app_icon->main_window = None;		wapp->app_icon->pid = 0;		wapp->app_icon->icon->owner = NULL;		wapp->app_icon->icon->icon_win = None;		wapp->app_icon->icon->force_paint = 1;		wAppIconPaint(wapp->app_icon);#ifdef REDUCE_APPICONS	    }#endif        } else if (wapp->app_icon->docked) {#ifdef REDUCE_APPICONS	    if (napps == 0)  {#endif		wapp->app_icon->running = 0;		wDockDetach(wapp->app_icon->dock, wapp->app_icon);#ifdef REDUCE_APPICONS	    }#endif         } else {#ifdef REDUCE_APPICONS    	    if (napps == 0) {#endif 		wAppIconDestroy(wapp->app_icon);#ifdef REDUCE_APPICONS    	    }#endif	}    }    wwin = wWindowFor(wapp->main_window_desc->client_win);    wWindowDestroy(wapp->main_window_desc);    if (wwin) {    	/* undelete client window context that was deleted in     	 * wWindowDestroy */    	XSaveContext(dpy, wwin->client_win, wWinContext, 		     (XPointer)&wwin->client_descriptor);    }    free(wapp);    #ifdef DEBUG    printf("Destroyed application for %x\n", (unsigned)main_window);#endif    if (wPreferences.auto_arrange_icons) {        wArrangeIcons(scr, True);    }#ifdef WMSOUND    wSoundPlay(WMSOUND_APPEXIT);#endif}