From 57b6c4a55a4510ff55d6411ed2775215929dc1ab Mon Sep 17 00:00:00 2001 From: Paul Richards Date: Mon, 4 Jun 2001 04:22:57 +0000 Subject: [PATCH] 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. --- usr.sbin/mailwrapper/mailwrapper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/mailwrapper/mailwrapper.c b/usr.sbin/mailwrapper/mailwrapper.c index 509496be08bc..7d6ad1427388 100644 --- a/usr.sbin/mailwrapper/mailwrapper.c +++ b/usr.sbin/mailwrapper/mailwrapper.c @@ -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);