rem: free(data);
add: wfree(data);
context: parseMenuCommand(WScreen *scr, Window win, char **slist, int count, int *index){    WMenu *menu;    int command;    int code, pos;    char title[300];    char rtext[300];    if (strlen(slist[*index])>300) {	wwarning("appmenu: menu command size exceeded in window %x", win);	return NULL;    }    if (sscanf(slist[*index], "%i %i %n", &command, &code, &pos)<2	|| command!=wmBeginMenu) {	wwarning("appmenu: bad menu entry \"%s\" in window %x",		 slist[*index], win);	return NULL;    }    strcpy(title, &slist[*index][pos]);    menu = wMenuCreateForApp(scr, title, *index==1);    if (!menu)      return NULL;    *index += 1;    while (*index<count) {	int ecode, etag, enab;	if (sscanf(slist[*index], "%i", &command)!=1) {	    wMenuDestroy(menu, True);	    wwarning("appmenu: bad menu entry \"%s\" in window %x", 		     slist[*index], win);	    return NULL;	}		if (command==wmEndMenu) {	    *index += 1;	    break;	    	} else if (command==wmNormalItem		   || command==wmDoubleItem) {	    WAppMenuData *data;	    WMenuEntry *entry;	    if (command == wmNormalItem) {		if (sscanf(slist[*index], "%i %i %i %i %n",			   &command, &ecode, &etag, &enab, &pos)!=4		    || ecode!=code) {		    wMenuDestroy(menu, True);		    wwarning("appmenu: bad menu entry \"%s\" in window %x", 			     slist[*index], win);		    return NULL;		}		strcpy(title, &slist[*index][pos]);		rtext[0] = 0;	    } else {		if (sscanf(slist[*index], "%i %i %i %i %s %n",			   &command, &ecode, &etag, &enab, rtext, &pos)!=5		    || ecode!=code) {		    wMenuDestroy(menu, True);		    wwarning("appmenu: bad menu entry \"%s\" in window %x", 			     slist[*index], win);		    return NULL;		}		strcpy(title, &slist[*index][pos]);	    }	    if (!(data = malloc(sizeof(WAppMenuData)))) {		wwarning("appmenu: out of memory making menu for window %x",			 win);		wMenuDestroy(menu, True);		return NULL;	    }	    data->code = code;	    data->tag = etag;	    data->window = win;	    entry = wMenuAddCallback(menu, title, notifyClient, data);	    if (!entry) {		wMenuDestroy(menu, True);		wwarning("appmenu: out of memory creating menu for window %x",			 slist[*index], win);		free(data);		return NULL;	    }	    if (rtext[0]!=0)	      entry->rtext = wstrdup(rtext);	    else	      entry->rtext = NULL;	    entry->free_cdata = free;	    *index += 1;	} else if (command==wmSubmenuItem) {	    int ncode;	    WMenuEntry *entry;	    WMenu *submenu;	    if (sscanf(slist[*index], "%i %i %i %i %i %n",		       &command, &ecode, &etag, &enab, &ncode, &pos)!=5		|| ecode!=code) {		wMenuDestroy(menu, True);		wwarning("appmenu: bad menu entry \"%s\" in window %x", 			 slist[*index], win);		return NULL;	    }	    strcpy(title, &slist[*index][pos]);	    *index += 1;	    submenu = parseMenuCommand(scr, win, slist, count, index);	    entry = wMenuAddCallback(menu, title, NULL, NULL);	    	    if (!entry) {		wMenuDestroy(menu, True);		wMenuDestroy(submenu, True);		wwarning("appmenu: out of memory creating menu for window %x",			 slist[*index], win);		return NULL;	    }	    wMenuEntrySetCascade(menu, entry, submenu);	    	} else {	    wMenuDestroy(menu, True);	    wwarning("appmenu: bad menu entry \"%s\" in window %x", 		     slist[*index], win);	    return NULL;	}    }        return menu;}