summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-20 15:29:55 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-20 15:29:55 +0000
commitc67eb64057520a47a77598e834b1027f6fde7fa4 (patch)
treef31ef707a719c3835e87ee3ede3f3d483f3d9e4e
parent89d439b76aa4949ed071267e2db8c7673bacd27e (diff)
Don't bother free()ing memory when we are just headed for exit().
Fixes a bug whereby freed memory was used in an error case.
-rw-r--r--usr.sbin/mailwrapper/mailwrapper.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/usr.sbin/mailwrapper/mailwrapper.c b/usr.sbin/mailwrapper/mailwrapper.c
index 84d536c5e27..0569cdf7fdd 100644
--- a/usr.sbin/mailwrapper/mailwrapper.c
+++ b/usr.sbin/mailwrapper/mailwrapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mailwrapper.c,v 1.11 2002/12/09 11:05:22 deraadt Exp $ */
+/* $OpenBSD: mailwrapper.c,v 1.12 2002/12/20 15:29:54 millert Exp $ */
/* $NetBSD: mailwrapper.c,v 1.2 1999/02/20 22:10:07 thorpej Exp $ */
/*
@@ -52,7 +52,6 @@ int main(int, char *[], char *[]);
static void initarg(struct arglist *);
static void addarg(struct arglist *, const char *, int);
-static void freearg(struct arglist *, int);
extern const char *__progname; /* from crt0.o */
@@ -90,16 +89,6 @@ addarg(struct arglist *al, const char *arg, int copy)
al->argv[al->argc++] = (char *)arg;
}
-static void
-freearg(struct arglist *al, int copy)
-{
- size_t i;
- if (copy)
- for (i = 0; i < al->argc; i++)
- free(al->argv[i]);
- free(al->argv);
-}
-
int
main(int argc, char *argv[], char *envp[])
{
@@ -119,7 +108,6 @@ main(int argc, char *argv[], char *envp[])
_PATH_MAILERCONF, _PATH_DEFAULTMTA);
closelog();
execve(_PATH_DEFAULTMTA, al.argv, envp);
- freearg(&al, 0);
err(1, "mailwrapper: execing %s", _PATH_DEFAULTMTA);
/*NOTREACHED*/
}
@@ -166,13 +154,9 @@ main(int argc, char *argv[], char *envp[])
addarg(&al, NULL, 0);
execve(to, al.argv, envp);
- freearg(&al, 0);
- free(line);
err(1, "mailwrapper: execing %s", to);
/*NOTREACHED*/
parse_error:
- freearg(&al, 0);
- free(line);
errx(1, "mailwrapper: parse error in %s at line %lu",
_PATH_MAILERCONF, (u_long)lineno);
/*NOTREACHED*/