1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

Use proper (w)free functions for (w)malloced data.

This commit is contained in:
Tobias Stoeckmann
2012-05-03 17:45:28 +02:00
committed by Carlos R. Mafra
parent 975d4becf1
commit 2755b1e45d
3 changed files with 8 additions and 8 deletions

View File

@@ -154,7 +154,7 @@ static WMenu *parseMenuCommand(WScreen * scr, Window win, char **slist, int coun
if (!entry) { if (!entry) {
wMenuDestroy(menu, True); wMenuDestroy(menu, True);
wwarning("appmenu: out of memory creating menu for window %lx", win); wwarning("appmenu: out of memory creating menu for window %lx", win);
wfree(data); free(data);
return NULL; return NULL;
} }
if (rtext[0] != 0) if (rtext[0] != 0)

View File

@@ -178,7 +178,7 @@ WMagicNumber wAddDeathHandler(pid_t pid, WDeathHandler * callback, void *cdata)
handler->client_data = cdata; handler->client_data = cdata;
if (!deathHandlers) if (!deathHandlers)
deathHandlers = WMCreateArrayWithDestructor(8, wfree); deathHandlers = WMCreateArrayWithDestructor(8, free);
WMAddToArray(deathHandlers, handler); WMAddToArray(deathHandlers, handler);
@@ -192,7 +192,7 @@ static void wdelete_death_handler(WMagicNumber id)
if (!handler || !deathHandlers) if (!handler || !deathHandlers)
return; return;
/* array destructor will call wfree(handler) */ /* array destructor will call free(handler) */
WMRemoveFromArray(deathHandlers, handler); WMRemoveFromArray(deathHandlers, handler);
} }

View File

@@ -783,7 +783,7 @@ static WMenuEntry *addMenuEntry(WMenu * menu, char *title, char *shortcut, char
dummy = wMenuCreate(scr, title, False); dummy = wMenuCreate(scr, title, False);
dummy->on_destroy = removeShortcutsForMenu; dummy->on_destroy = removeShortcutsForMenu;
entry = wMenuAddCallback(menu, title, constructMenu, path); entry = wMenuAddCallback(menu, title, constructMenu, path);
entry->free_cdata = free; entry->free_cdata = wfree;
wMenuEntrySetCascade(menu, entry, dummy); wMenuEntrySetCascade(menu, entry, dummy);
} }
} else if (strcmp(command, "EXEC") == 0) { } else if (strcmp(command, "EXEC") == 0) {
@@ -791,7 +791,7 @@ static WMenuEntry *addMenuEntry(WMenu * menu, char *title, char *shortcut, char
wwarning(_("%s:missing parameter for menu command \"%s\""), file_name, command); wwarning(_("%s:missing parameter for menu command \"%s\""), file_name, command);
else { else {
entry = wMenuAddCallback(menu, title, execCommand, wstrconcat("exec ", params)); entry = wMenuAddCallback(menu, title, execCommand, wstrconcat("exec ", params));
entry->free_cdata = free; entry->free_cdata = wfree;
shortcutOk = True; shortcutOk = True;
} }
} else if (strcmp(command, "SHEXEC") == 0) { } else if (strcmp(command, "SHEXEC") == 0) {
@@ -799,7 +799,7 @@ static WMenuEntry *addMenuEntry(WMenu * menu, char *title, char *shortcut, char
wwarning(_("%s:missing parameter for menu command \"%s\""), file_name, command); wwarning(_("%s:missing parameter for menu command \"%s\""), file_name, command);
else { else {
entry = wMenuAddCallback(menu, title, execCommand, wstrdup(params)); entry = wMenuAddCallback(menu, title, execCommand, wstrdup(params));
entry->free_cdata = free; entry->free_cdata = wfree;
shortcutOk = True; shortcutOk = True;
} }
} else if (strcmp(command, "EXIT") == 0) { } else if (strcmp(command, "EXIT") == 0) {
@@ -844,7 +844,7 @@ static WMenuEntry *addMenuEntry(WMenu * menu, char *title, char *shortcut, char
shortcutOk = True; shortcutOk = True;
} else if (strcmp(command, "RESTART") == 0) { } else if (strcmp(command, "RESTART") == 0) {
entry = wMenuAddCallback(menu, title, restartCommand, params ? wstrdup(params) : NULL); entry = wMenuAddCallback(menu, title, restartCommand, params ? wstrdup(params) : NULL);
entry->free_cdata = free; entry->free_cdata = wfree;
shortcutOk = True; shortcutOk = True;
} else if (strcmp(command, "SAVE_SESSION") == 0) { } else if (strcmp(command, "SAVE_SESSION") == 0) {
entry = wMenuAddCallback(menu, title, saveSessionCommand, NULL); entry = wMenuAddCallback(menu, title, saveSessionCommand, NULL);
@@ -1344,7 +1344,7 @@ static WMenu *readMenuDirectory(WScreen * scr, char *title, char **path, char *c
} }
} }
} }
wfree(buffer); free(buffer);
} }
closedir(dir); closedir(dir);