rem: free(tmp);
add: wfree(tmp);
context: customPaletteMenuNewFromFile(W_ColorPanel *panel){    W_Screen		*scr = WMWidgetScreen(panel->win);    WMOpenPanel		*browseP;    char			*filepath;    char			*filename = NULL;    char			*spath;    char			*tmp;    int				i;    RImage			*tmpImg = NULL;        if ((!panel->lastBrowseDir) || (strcmp(panel->lastBrowseDir,"\0") == 0))	spath = wexpandpath(wgethomedir());    else	spath = wexpandpath(panel->lastBrowseDir);        browseP = WMGetOpenPanel(scr);    WMSetFilePanelCanChooseDirectories(browseP, 0);    WMSetFilePanelCanChooseFiles(browseP, 1);        /* Get a filename */    if (WMRunModalFilePanelForDirectory(browseP, panel->win, spath, 					"Open Palette", 					RSupportedFileFormats()) ) {	filepath = WMGetFilePanelFileName(browseP);		/* Get seperation position between path and filename */ 	i = strrchr(filepath, '/') - filepath + 1;	if (i > strlen(filepath))	    i = strlen(filepath);		/* Store last browsed path */	if (panel->lastBrowseDir)	    free(panel->lastBrowseDir);	panel->lastBrowseDir = wmalloc((i+1)*sizeof(char));	strncpy(panel->lastBrowseDir, filepath, i);	panel->lastBrowseDir[i] = '\0';		/* Get filename from path */	filename = wstrdup(filepath + i);		/* Check for duplicate files, and rename it if there are any */	tmp = wstrappend(panel->configurationPath, filename);	while (access (tmp, F_OK) == 0) {	    char	*newName;	    	    free(tmp);	    	    newName = generateNewFilename(filename);	    free(filename);	    filename = newName;	    	    tmp = wstrappend(panel->configurationPath, filename);	}	free(tmp);		/* Copy image to $(gnustepdir)/Library/Colors/ & 	 * Add filename to history menu */	if (fetchFile (panel->configurationPath, filepath, filename) == 0) {	    	    /* filepath is a "local" path now the file has been copied */	    free(filepath);	    filepath = wstrappend(panel->configurationPath, filename);	    	    /* load the image & add menu entries */	    tmpImg = RLoadImage(scr->rcontext, filepath, 0);	    if (tmpImg) {		if (panel->customPaletteImg)		    RDestroyImage(panel->customPaletteImg);		panel->customPaletteImg = tmpImg;				customSetPalette(panel);		WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, filename);				panel->currentPalette = WMGetPopUpButtonNumberOfItems(								      panel->customPaletteHistoryBtn)-1;				WMSetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn,					     panel->currentPalette);	    }	} 	else	{	    tmp = wstrappend(panel->configurationPath, filename);	    	    i = remove(tmp);	/* Delete the file, it doesn't belong here */				    WMRunAlertPanel(scr, panel->win, "File Error", 			    "Invalid file format !", "OK", NULL, NULL);	    if (i != 0) {		wsyserror("can't remove file %s", tmp);		WMRunAlertPanel(scr, panel->win, "File Error", 				"Couldn't remove file from Configuration Directory !", 				"OK", NULL, NULL);	    }	    free(tmp);	}	free(filepath);	free(filename);    }    WMFreeFilePanel(browseP);        free(spath);}