You can't free a string and then use it as the error message to

errx. Instead use warn to print the string, then cleanup and exit
normally.

This fixes a core dump if the executable to be run doesn't exist.
This commit is contained in:
Paul Richards 2001-06-04 04:22:57 +00:00
parent 1b3e974a71
commit 57b6c4a55a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77679

View File

@ -176,8 +176,9 @@ main(argc, argv, envp)
addarg(&al, NULL, 0);
execve(to, al.argv, envp);
freearg(&al, 0);
warn("execing %s", to);
free(line);
err(1, "execing %s", to);
exit(1);
/*NOTREACHED*/
parse_error:
freearg(&al, 0);