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

Use wtokenfree whenever there is wtokensplit

Whenever wtokensplit is used to split into argv/argc, it's better to
use the built-in function wtokenfree() as a wfree call only on argv
is not freeing the memory properly.
This commit is contained in:
David Maciejak
2023-03-04 11:16:17 +08:00
committed by Carlos R. Mafra
parent 80e8dd43f7
commit 7185af15cf
3 changed files with 4 additions and 6 deletions

View File

@@ -393,7 +393,7 @@ Bool RelaunchWindow(WWindow *wwin)
} else if (pid < 0) { } else if (pid < 0) {
werror("cannot fork a new process"); werror("cannot fork a new process");
wfree(argv); wtokenfree(argv, argc);
wfree(command); wfree(command);
return False; return False;
} else { } else {
@@ -405,7 +405,7 @@ Bool RelaunchWindow(WWindow *wwin)
/* not actually a shell command */ /* not actually a shell command */
wAddDeathHandler(pid, shellCommandHandler, data); wAddDeathHandler(pid, shellCommandHandler, data);
wfree(argv); wtokenfree(argv, argc);
} }
return True; return True;

View File

@@ -392,9 +392,7 @@ static pid_t execCommand(WScreen *scr, char *command)
execvp(argv[0], args); execvp(argv[0], args);
exit(111); exit(111);
} }
while (argc > 0) wtokenfree(argv, argc);
wfree(argv[--argc]);
wfree(argv);
return pid; return pid;
} }

View File

@@ -451,7 +451,7 @@ static void find_and_write(const char *group, char *list[][2], int this_is_termi
WMAddToPLArray(L2Menu, L3Menu); WMAddToPLArray(L2Menu, L3Menu);
wfree(t); wfree(t);
} }
wfree(argv); wtokenfree(argv, argc);
i++; i++;
} }
if (L2Menu) if (L2Menu)