mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-11 11:15:55 +01:00
- Replaced all free() with wfree() where appropriate
- Fixed some memory leaks
This commit is contained in:
@@ -658,8 +658,8 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
image = RRenderMultiGradient(width, height, colors, style);
|
||||
|
||||
for (i = 0; colors[i]!=NULL; i++)
|
||||
free(colors[i]);
|
||||
free(colors);
|
||||
wfree(colors[i]);
|
||||
wfree(colors);
|
||||
}
|
||||
} else if (strcasecmp(&type[1], "pixmap")==0) {
|
||||
RImage *timage = NULL;
|
||||
@@ -698,7 +698,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
}
|
||||
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
if (!image)
|
||||
@@ -931,7 +931,7 @@ makeFileName(char *prefix)
|
||||
while (access(fname, F_OK)==0) {
|
||||
char buf[30];
|
||||
|
||||
free(fname);
|
||||
wfree(fname);
|
||||
sprintf(buf, "%08lx.cache", time(NULL));
|
||||
fname = wstrappend(prefix, buf);
|
||||
}
|
||||
@@ -1000,7 +1000,7 @@ okEditTexture(void *data)
|
||||
if (titem->current) {
|
||||
name = GetTexturePanelTextureName(panel->texturePanel);
|
||||
|
||||
free(titem->title);
|
||||
wfree(titem->title);
|
||||
titem->title = name;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ okEditTexture(void *data)
|
||||
|
||||
titem->ispixmap = isPixmap(prop);
|
||||
|
||||
free(titem->texture);
|
||||
wfree(titem->texture);
|
||||
titem->texture = str;
|
||||
|
||||
XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel->texLs)), titem->preview);
|
||||
@@ -1096,17 +1096,17 @@ deleteTexture(WMWidget *w, void *data)
|
||||
titem2->selectedFor |= 1 << section;
|
||||
}
|
||||
|
||||
free(titem->title);
|
||||
free(titem->texture);
|
||||
wfree(titem->title);
|
||||
wfree(titem->texture);
|
||||
PLRelease(titem->prop);
|
||||
if (titem->path) {
|
||||
if (remove(titem->path) < 0 && errno != ENOENT) {
|
||||
wsyserror("could not remove file %s", titem->path);
|
||||
}
|
||||
free(titem->path);
|
||||
wfree(titem->path);
|
||||
}
|
||||
|
||||
free(titem);
|
||||
wfree(titem);
|
||||
|
||||
WMRemoveListItem(panel->texLs, row);
|
||||
WMSetButtonEnabled(panel->delB, False);
|
||||
@@ -1133,7 +1133,7 @@ extractTexture(WMWidget *w, void *data)
|
||||
|
||||
OpenExtractPanelFor(panel, path);
|
||||
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1705,7 +1705,7 @@ createPanel(Panel *p)
|
||||
}
|
||||
if (ok) {
|
||||
tmp = wstrappend(panel->fprefix, "/WPrefs/");
|
||||
free(panel->fprefix);
|
||||
wfree(panel->fprefix);
|
||||
panel->fprefix = tmp;
|
||||
if (access(panel->fprefix, F_OK)!=0) {
|
||||
if (mkdir(panel->fprefix, 0755) < 0) {
|
||||
@@ -1964,7 +1964,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
WMGroupButtons(panel->mstyB[0], panel->mstyB[1]);
|
||||
@@ -2126,7 +2126,7 @@ storeData(_Panel *panel)
|
||||
|
||||
if (str) {
|
||||
SetStringForKey(str, colorOptions[i*2]);
|
||||
free(str);
|
||||
wfree(str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2195,7 +2195,7 @@ prepareForClose(_Panel *panel)
|
||||
|
||||
str = WMGetColorRGBDescription(color);
|
||||
PLAppendArrayElement(textureList, PLMakeString(str));
|
||||
free(str);
|
||||
wfree(str);
|
||||
}
|
||||
WMSetUDObjectForKey(udb, textureList, "ColorList");
|
||||
PLRelease(textureList);
|
||||
|
||||
@@ -148,13 +148,13 @@ createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
|
||||
*icon1 = WMCreatePixmapFromFile(scr, path);
|
||||
if (!*icon1) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
free(path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
icon = RLoadImage(rc, path, 0);
|
||||
if (!icon) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
free(path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
RCombineImageWithColor(icon, &gray);
|
||||
@@ -164,7 +164,7 @@ createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
|
||||
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
|
||||
}
|
||||
RDestroyImage(icon);
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ createPanel(Panel *p)
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->frame = WMCreateFrame(panel->win);
|
||||
@@ -241,7 +241,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
@@ -253,11 +253,11 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
free(buf1);
|
||||
free(buf2);
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
|
||||
WMMapSubwidgets(panel->icoF);
|
||||
@@ -283,7 +283,7 @@ createPanel(Panel *p)
|
||||
RImage *image, *scaled;
|
||||
|
||||
image = RLoadImage(WMScreenRContext(scr), path, 0);
|
||||
free(path);
|
||||
wfree(path);
|
||||
|
||||
scaled = RScaleImage(image, 61, 61);
|
||||
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
|
||||
@@ -336,7 +336,7 @@ createPanel(Panel *p)
|
||||
WMSetButtonImage(panel->oldsB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
WMGroupButtons(panel->newsB, panel->oldsB);
|
||||
|
||||
@@ -315,7 +315,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
@@ -326,11 +326,11 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
free(buf1);
|
||||
free(buf2);
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
panel->raisT = WMCreateTextField(panel->raisF);
|
||||
WMResizeWidget(panel->raisT, 36, 20);
|
||||
|
||||
@@ -191,12 +191,12 @@ captureClick(WMWidget *w, void *data)
|
||||
WMSetTextFieldText(panel->shoT, shortcut);
|
||||
if (row>=0) {
|
||||
if (panel->shortcuts[row])
|
||||
free(panel->shortcuts[row]);
|
||||
wfree(panel->shortcuts[row]);
|
||||
panel->shortcuts[row] = shortcut;
|
||||
|
||||
WMRedisplayWidget(panel->actLs);
|
||||
} else {
|
||||
free(shortcut);
|
||||
wfree(shortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ clearShortcut(WMWidget *w, void *data)
|
||||
|
||||
if (row>=0) {
|
||||
if (panel->shortcuts[row])
|
||||
free(panel->shortcuts[row]);
|
||||
wfree(panel->shortcuts[row]);
|
||||
panel->shortcuts[row]=NULL;
|
||||
WMRedisplayWidget(panel->actLs);
|
||||
}
|
||||
@@ -236,10 +236,10 @@ typedKeys(void *observerData, WMNotification *notification)
|
||||
return;
|
||||
|
||||
if (panel->shortcuts[row])
|
||||
free(panel->shortcuts[row]);
|
||||
wfree(panel->shortcuts[row]);
|
||||
panel->shortcuts[row] = WMGetTextFieldText(panel->shoT);
|
||||
if (strlen(panel->shortcuts[row])==0) {
|
||||
free(panel->shortcuts[row]);
|
||||
wfree(panel->shortcuts[row]);
|
||||
panel->shortcuts[row] = NULL;
|
||||
}
|
||||
WMRedisplayWidget(panel->actLs);
|
||||
@@ -285,7 +285,7 @@ showData(_Panel *panel)
|
||||
|
||||
str = GetStringForKey(keyOptions[i]);
|
||||
if (panel->shortcuts[i])
|
||||
free(panel->shortcuts[i]);
|
||||
wfree(panel->shortcuts[i]);
|
||||
if (str)
|
||||
panel->shortcuts[i] = trimstr(str);
|
||||
else
|
||||
@@ -294,7 +294,7 @@ showData(_Panel *panel)
|
||||
if (panel->shortcuts[i] &&
|
||||
(strcasecmp(panel->shortcuts[i], "none")==0
|
||||
|| strlen(panel->shortcuts[i])==0)) {
|
||||
free(panel->shortcuts[i]);
|
||||
wfree(panel->shortcuts[i]);
|
||||
panel->shortcuts[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -479,13 +479,13 @@ storeData(_Panel *panel)
|
||||
if (panel->shortcuts[i]) {
|
||||
str = trimstr(panel->shortcuts[i]);
|
||||
if (strlen(str)==0) {
|
||||
free(str);
|
||||
wfree(str);
|
||||
str = NULL;
|
||||
}
|
||||
}
|
||||
if (str) {
|
||||
SetStringForKey(str, keyOptions[i]);
|
||||
free(str);
|
||||
wfree(str);
|
||||
} else {
|
||||
SetStringForKey("None", keyOptions[i]);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ sgrabClicked(WMWidget *w, void *data)
|
||||
if (shortcut) {
|
||||
WMSetTextFieldText(panel->shortT, shortcut);
|
||||
updateMenuItem(panel, panel->currentItem, panel->shortT);
|
||||
free(shortcut);
|
||||
wfree(shortcut);
|
||||
}
|
||||
}
|
||||
panel->capturing = 0;
|
||||
@@ -908,7 +908,7 @@ createPanel(_Panel *p)
|
||||
static void
|
||||
freeItemData(ItemData *data)
|
||||
{
|
||||
#define CFREE(d) if (d) free(d)
|
||||
#define CFREE(d) if (d) wfree(d)
|
||||
|
||||
/* TODO */
|
||||
switch (data->type) {
|
||||
@@ -939,7 +939,7 @@ freeItemData(ItemData *data)
|
||||
break;
|
||||
}
|
||||
|
||||
free(data);
|
||||
wfree(data);
|
||||
#undef CFREE
|
||||
}
|
||||
|
||||
@@ -1007,20 +1007,20 @@ parseCommand(proplist_t item)
|
||||
data->param.directory.command = wstrdup(s);
|
||||
|
||||
wtokensplit(p, &tokens, &tokn);
|
||||
free(p);
|
||||
wfree(p);
|
||||
|
||||
ctokens = wmalloc(sizeof(char*)*tokn);
|
||||
|
||||
for (i = 0, j = 0; i < tokn; i++) {
|
||||
if (strcmp(tokens[i], "-noext") == 0) {
|
||||
free(tokens[i]);
|
||||
wfree(tokens[i]);
|
||||
data->param.directory.stripExt = 1;
|
||||
} else {
|
||||
ctokens[j++] = tokens[i];
|
||||
}
|
||||
}
|
||||
data->param.directory.directory = wtokenjoin(ctokens, j);
|
||||
free(ctokens);
|
||||
wfree(ctokens);
|
||||
|
||||
wtokenfree(tokens, tokn);
|
||||
} else {
|
||||
@@ -1076,7 +1076,7 @@ parseCommand(proplist_t item)
|
||||
return data;
|
||||
|
||||
error:
|
||||
free(data);
|
||||
wfree(data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1120,7 +1120,7 @@ updateFrameTitle(_Panel *panel, char *title, InfoType type)
|
||||
break;
|
||||
}
|
||||
WMSetFrameTitle(panel->optionsF, tmp);
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
} else {
|
||||
WMSetFrameTitle(panel->optionsF, NULL);
|
||||
}
|
||||
@@ -1168,7 +1168,7 @@ updateMenuItem(_Panel *panel, WEditMenuItem *item, WMWidget *changedWidget)
|
||||
|
||||
assert(data != NULL);
|
||||
|
||||
#define REPLACE(v, d) if (v) free(v); v = d
|
||||
#define REPLACE(v, d) if (v) wfree(v); v = d
|
||||
|
||||
switch (data->type) {
|
||||
case ExecInfo:
|
||||
@@ -1526,7 +1526,7 @@ getDefaultMenu(_Panel *panel)
|
||||
}
|
||||
}
|
||||
|
||||
free(menuPath);
|
||||
wfree(menuPath);
|
||||
|
||||
if (menu) {
|
||||
pmenu = menu;
|
||||
@@ -1671,7 +1671,7 @@ processData(char *title, ItemData *data)
|
||||
PLAppendArrayElement(item, pomenu);
|
||||
s1 = wstrappend("| ", data->param.pipe.command);
|
||||
PLAppendArrayElement(item, PLMakeString(s1));
|
||||
free(s1);
|
||||
wfree(s1);
|
||||
break;
|
||||
|
||||
case ExternalInfo:
|
||||
@@ -1697,7 +1697,7 @@ processData(char *title, ItemData *data)
|
||||
data->param.directory.command);
|
||||
|
||||
PLAppendArrayElement(item, PLMakeString(tmp));
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
@@ -147,11 +147,11 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
free(buf1);
|
||||
free(buf2);
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
WMMapSubwidgets(panel->scrF);
|
||||
|
||||
@@ -175,7 +175,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
panel->aliyB = WMCreateButton(panel->aliF, WBTOnOff);
|
||||
WMResizeWidget(panel->aliyB, 48, 48);
|
||||
@@ -190,7 +190,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
WMGroupButtons(panel->alinB, panel->aliyB);
|
||||
|
||||
|
||||
@@ -152,11 +152,11 @@ speedChange(WMWidget *w, void *data)
|
||||
_("Error"),
|
||||
_("Invalid mouse acceleration value. Must be a positive real value."),
|
||||
_("OK"), NULL, NULL);
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
return;
|
||||
}
|
||||
panel->acceleration = accel;
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
} else {
|
||||
i = (int)WMGetSliderValue(panel->speedS);
|
||||
|
||||
@@ -176,7 +176,7 @@ speedChange(WMWidget *w, void *data)
|
||||
setMouseAccel(WMWidgetScreen(panel->win), panel->acceleration,
|
||||
threshold);
|
||||
}
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
|
||||
@@ -432,17 +432,17 @@ fillModifierPopUp(WMPopUpButton *pop)
|
||||
if (array[i] == NULL)
|
||||
continue;
|
||||
if (strstr(array[i], tmp)) {
|
||||
free(array[i]);
|
||||
wfree(array[i]);
|
||||
array[i]=NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
while (--a>0) {
|
||||
if (array[a])
|
||||
free(array[a]);
|
||||
wfree(array[a]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->speedS = WMCreateSlider(panel->speedF);
|
||||
@@ -560,7 +560,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
@@ -571,11 +571,11 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
free(buf1);
|
||||
free(buf2);
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
panel->tester = CreateDoubleTest(panel->ddelaF, _("Test"));
|
||||
WMResizeWidget(panel->tester, 84, 29);
|
||||
@@ -710,7 +710,8 @@ storeCommandInScript(char *cmd, char *line)
|
||||
"/Library/WindowMaker/autostart.tmp");
|
||||
fo = fopen(tmppath, "w");
|
||||
if (!fo) {
|
||||
wsyserror(_("could not create temporary file %s"), tmppath);
|
||||
wsyserror(_("could not create temporary file %s"), tmppath);
|
||||
wfree(tmppath);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -743,13 +744,13 @@ storeCommandInScript(char *cmd, char *line)
|
||||
if (rename(tmppath, path)!=0) {
|
||||
wsyserror(_("could not rename file %s to %s\n"), tmppath, path);
|
||||
}
|
||||
free(tmppath);
|
||||
wfree(tmppath);
|
||||
}
|
||||
sprintf(buffer, "chmod u+x %s", path);
|
||||
system(buffer);
|
||||
|
||||
end:
|
||||
free(path);
|
||||
wfree(path);
|
||||
if (f)
|
||||
fclose(f);
|
||||
}
|
||||
@@ -767,7 +768,7 @@ storeData(_Panel *panel)
|
||||
if (!WMGetUDBoolForKey(udb, "NoXSetStuff")) {
|
||||
tmp = WMGetTextFieldText(panel->threT);
|
||||
if (strlen(tmp)==0) {
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
tmp = wstrdup("4");
|
||||
}
|
||||
|
||||
@@ -775,7 +776,7 @@ storeData(_Panel *panel)
|
||||
10, tmp);
|
||||
storeCommandInScript(XSET" m", buffer);
|
||||
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
tmp = WMGetTextFieldText(panel->ddelaT);
|
||||
@@ -801,7 +802,7 @@ storeData(_Panel *panel)
|
||||
|
||||
SetStringForKey(tmp, "ModifierKey");
|
||||
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ addPathToList(WMList *list, int index, char *path)
|
||||
if (access(fpath, X_OK)!=0) {
|
||||
item->uflags = 1;
|
||||
}
|
||||
free(fpath);
|
||||
wfree(fpath);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ browseForFile(WMWidget *w, void *data)
|
||||
addPathToList(lPtr, i, str);
|
||||
WMSetListBottomPosition(lPtr, WMGetListNumberOfRows(lPtr));
|
||||
|
||||
free(str);
|
||||
wfree(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ updateGradButtons(TexturePanel *panel)
|
||||
WMSetButtonImage(panel->dirdB, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
|
||||
free(colors);
|
||||
wfree(colors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ updateHueSlider(WMSlider *sPtr, WMFont *font, RHSVColor *hsv)
|
||||
WMReleasePixmap(pixmap);
|
||||
|
||||
for (i = 0; i <= 6; i++)
|
||||
free(colors[i]);
|
||||
wfree(colors[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ sliderChangeCallback(WMWidget *w, void *data)
|
||||
RConvertImage(WMScreenRContext(scr), image, &panel->gimage);
|
||||
RDestroyImage(image);
|
||||
|
||||
free(colors);
|
||||
wfree(colors);
|
||||
|
||||
WMRedisplayWidget(panel->gcolL);
|
||||
|
||||
@@ -554,7 +554,7 @@ gradDeleteCallback(WMWidget *w, void *data)
|
||||
return;
|
||||
|
||||
item = WMGetListItem(panel->gcolL, row);
|
||||
free(item->clientData);
|
||||
wfree(item->clientData);
|
||||
|
||||
WMRemoveListItem(panel->gcolL, row);
|
||||
|
||||
@@ -610,7 +610,9 @@ updateImage(TexturePanel *panel, char *path)
|
||||
|
||||
if (!panel->image)
|
||||
WMSetButtonEnabled(panel->okB, False);
|
||||
return;
|
||||
|
||||
wfree(message);
|
||||
return;
|
||||
}
|
||||
|
||||
WMSetButtonEnabled(panel->okB, True);
|
||||
@@ -663,7 +665,7 @@ browseImageCallback(WMWidget *w, void *data)
|
||||
return;
|
||||
fullpath = tmp;
|
||||
|
||||
free(ipath);
|
||||
wfree(ipath);
|
||||
ipath = fullpath;
|
||||
|
||||
path = wstrdup(fullpath);
|
||||
@@ -676,20 +678,20 @@ browseImageCallback(WMWidget *w, void *data)
|
||||
|
||||
if (tmp) {
|
||||
if (strcmp(fullpath, tmp)==0) {
|
||||
free(path);
|
||||
wfree(path);
|
||||
path = tmp2;
|
||||
}
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
if (!RGetImageFileFormat(fullpath)) {
|
||||
WMRunAlertPanel(scr, panel->win, _("Error"),
|
||||
_("The selected file does not contain a supported image."),
|
||||
_("OK"), NULL, NULL);
|
||||
free(path);
|
||||
wfree(path);
|
||||
} else {
|
||||
updateImage(panel, fullpath);
|
||||
free(panel->imageFile);
|
||||
wfree(panel->imageFile);
|
||||
panel->imageFile = path;
|
||||
|
||||
WMSetTextFieldText(panel->imageT, path);
|
||||
@@ -891,7 +893,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
WMSetTextFieldText(panel->imageT,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
if (panel->imageFile)
|
||||
free(panel->imageFile);
|
||||
wfree(panel->imageFile);
|
||||
panel->imageFile = wstrdup(PLGetString(PLGetArrayElement(texture, 1)));
|
||||
|
||||
|
||||
@@ -927,7 +929,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
|
||||
if (panel->imageFile)
|
||||
free(panel->imageFile);
|
||||
wfree(panel->imageFile);
|
||||
if ((panel->imageFile = wfindfileinarray(panel->pathList,
|
||||
PLGetString(PLGetArrayElement(texture, 1)))) != NULL) {
|
||||
|
||||
@@ -946,7 +948,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) {
|
||||
item = WMGetListItem(panel->gcolL, i);
|
||||
free(item->clientData);
|
||||
wfree(item->clientData);
|
||||
}
|
||||
WMClearList(panel->gcolL);
|
||||
|
||||
@@ -1019,7 +1021,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
|
||||
if (panel->imageFile)
|
||||
free(panel->imageFile);
|
||||
wfree(panel->imageFile);
|
||||
panel->imageFile = wfindfileinarray(panel->pathList,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
|
||||
@@ -1055,7 +1057,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
bad_texture:
|
||||
str = PLGetDescription(texture);
|
||||
wwarning("error creating texture %s", str);
|
||||
free(str);
|
||||
wfree(str);
|
||||
|
||||
}
|
||||
|
||||
@@ -1087,7 +1089,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
str = WMGetColorRGBDescription(color);
|
||||
prop = PLMakeArrayFromElements(PLMakeString("solid"),
|
||||
PLMakeString(str), NULL);
|
||||
free(str);
|
||||
wfree(str);
|
||||
|
||||
break;
|
||||
|
||||
@@ -1117,7 +1119,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
PLMakeString(str), NULL);
|
||||
break;
|
||||
}
|
||||
free(str);
|
||||
wfree(str);
|
||||
break;
|
||||
|
||||
case TYPE_TGRADIENT:
|
||||
@@ -1148,8 +1150,8 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
}
|
||||
free(str);
|
||||
free(str2);
|
||||
wfree(str);
|
||||
wfree(str2);
|
||||
break;
|
||||
|
||||
|
||||
@@ -1173,8 +1175,8 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
}
|
||||
free(str);
|
||||
free(str2);
|
||||
wfree(str);
|
||||
wfree(str2);
|
||||
break;
|
||||
|
||||
case TYPE_GRADIENT:
|
||||
@@ -1191,7 +1193,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
prop = PLMakeArrayFromElements(PLMakeString("mhgradient"),
|
||||
PLMakeString(str), NULL);
|
||||
}
|
||||
free(str);
|
||||
wfree(str);
|
||||
|
||||
for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) {
|
||||
RColor *rgb;
|
||||
@@ -1608,7 +1610,7 @@ testOKButton(WMWidget *self, void *data)
|
||||
XCopyArea(dpy, pix, win, (WMScreenRContext(WMWidgetScreen(panel->okB)))->copy_gc, 0, 0, image->width, image->height,
|
||||
0, 0);
|
||||
|
||||
free (test);
|
||||
wfree (test);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ LocateImage(char *name)
|
||||
sprintf(tmp, "%s.xpm", name);
|
||||
path = WMPathForResourceOfType(tmp, "xpm");
|
||||
}
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
if (!path) {
|
||||
wwarning(_("could not locate image file %s\n"), name);
|
||||
}
|
||||
@@ -584,7 +584,7 @@ SetButtonAlphaImage(WMScreen *scr, WMButton *bPtr, char *file,
|
||||
WMReleasePixmap(icon);
|
||||
|
||||
if (iconPath)
|
||||
free(iconPath);
|
||||
wfree(iconPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -618,7 +618,7 @@ AddSection(Panel *panel, char *iconFile)
|
||||
}
|
||||
SetButtonAlphaImage(WMWidgetScreen(bPtr), bPtr, iconFile,
|
||||
t1, t2);
|
||||
free(t1);
|
||||
wfree(t1);
|
||||
}
|
||||
WMMapWidget(bPtr);
|
||||
|
||||
@@ -670,7 +670,7 @@ Initialize(WMScreen *scr)
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
memset(&WPrefs, 0, sizeof(_WPrefs));
|
||||
@@ -753,7 +753,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
path);
|
||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
|
||||
path = getenv("WMAKER_BIN_NAME");
|
||||
if (!path)
|
||||
@@ -763,7 +763,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
|
||||
command = wstrappend(path, " --version");
|
||||
file = popen(command, "r");
|
||||
free(command);
|
||||
wfree(command);
|
||||
}
|
||||
if (!file || !fgets(buffer, 1023, file)) {
|
||||
wsyserror(_("could not extract version information from Window Maker"));
|
||||
@@ -804,7 +804,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
|
||||
command = wstrappend(path, " --global_defaults_path");
|
||||
file = popen(command, "r");
|
||||
free(command);
|
||||
wfree(command);
|
||||
}
|
||||
if (!file || !fgets(buffer, 1023, file)) {
|
||||
wsyserror(_("could not run \"%s --global_defaults_path\"."), path);
|
||||
|
||||
@@ -330,7 +330,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
path = LocateImage(OPAQUE_MOVE_PIXMAP);
|
||||
@@ -342,7 +342,7 @@ createPanel(Panel *p)
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
WMMapSubwidgets(panel->opaqF);
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ createPanel(Panel *p)
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->frame = WMCreateFrame(panel->win);
|
||||
@@ -194,7 +194,7 @@ createPanel(Panel *p)
|
||||
WMSetLabelImage(panel->cyclL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -216,7 +216,7 @@ createPanel(Panel *p)
|
||||
WMSetLabelImage(panel->linkL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -238,7 +238,7 @@ createPanel(Panel *p)
|
||||
WMSetLabelImage(panel->newL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -261,7 +261,7 @@ createPanel(Panel *p)
|
||||
WMSetLabelImage(panel->posiL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->posP = WMCreatePopUpButton(panel->navF);
|
||||
@@ -299,7 +299,7 @@ createPanel(Panel *p)
|
||||
WMSetButtonAltImage(panel->dockB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
|
||||
"vertical icon bar in the side of the screen)."),
|
||||
@@ -320,7 +320,7 @@ createPanel(Panel *p)
|
||||
WMSetButtonAltImage(panel->clipB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
|
||||
"a paper clip icon)."),
|
||||
|
||||
@@ -74,7 +74,7 @@ CreateDoubleTest(WMWidget *parent, char *text)
|
||||
|
||||
dPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!dPtr->view) {
|
||||
free(dPtr);
|
||||
wfree(dPtr);
|
||||
return NULL;
|
||||
}
|
||||
/* always do this */
|
||||
@@ -186,9 +186,9 @@ destroyDoubleTest(_DoubleTest *dPtr)
|
||||
if (dPtr->timer)
|
||||
WMDeleteTimerHandler(dPtr->timer);
|
||||
if (dPtr->text)
|
||||
free(dPtr->text);
|
||||
wfree(dPtr->text);
|
||||
|
||||
free(dPtr);
|
||||
wfree(dPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ WCreateEditMenuItem(WMWidget *parent, char *title, Bool isTitle)
|
||||
|
||||
iPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!iPtr->view) {
|
||||
free(iPtr);
|
||||
wfree(iPtr);
|
||||
return NULL;
|
||||
}
|
||||
iPtr->view->self = iPtr;
|
||||
@@ -300,13 +300,13 @@ static void
|
||||
destroyEditMenuItem(WEditMenuItem *iPtr)
|
||||
{
|
||||
if (iPtr->label)
|
||||
free(iPtr->label);
|
||||
wfree(iPtr->label);
|
||||
if (iPtr->data && iPtr->destroyData)
|
||||
(*iPtr->destroyData)(iPtr->data);
|
||||
if (iPtr->submenu)
|
||||
WMDestroyWidget(iPtr->submenu);
|
||||
|
||||
free(iPtr);
|
||||
wfree(iPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@ makeEditMenu(WMScreen *scr, WMWidget *parent, char *title)
|
||||
mPtr->flags.standalone = 1;
|
||||
}
|
||||
if (!mPtr->view) {
|
||||
free(mPtr);
|
||||
wfree(mPtr);
|
||||
return NULL;
|
||||
}
|
||||
mPtr->view->self = mPtr;
|
||||
@@ -553,7 +553,7 @@ WSetEditMenuTitle(WEditMenu *mPtr, char *title)
|
||||
|
||||
item = WMGetFromBag(mPtr->items, 0);
|
||||
|
||||
free(item->label);
|
||||
wfree(item->label);
|
||||
item->label = wstrdup(title);
|
||||
|
||||
updateMenuContents(mPtr);
|
||||
@@ -958,7 +958,7 @@ stopEditItem(WEditMenu *menu, Bool apply)
|
||||
if (apply) {
|
||||
text = WMGetTextFieldText(menu->tfield);
|
||||
|
||||
free(menu->selectedItem->label);
|
||||
wfree(menu->selectedItem->label);
|
||||
menu->selectedItem->label = wstrdup(text);
|
||||
|
||||
updateMenuContents(menu);
|
||||
@@ -1548,9 +1548,9 @@ destroyEditMenu(WEditMenu *mPtr)
|
||||
|
||||
WMFreeBag(mPtr->items);
|
||||
|
||||
free(mPtr->tdelegate);
|
||||
wfree(mPtr->tdelegate);
|
||||
|
||||
free(mPtr);
|
||||
wfree(mPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user