summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-07-06 03:38:14 +0000
committermillert <millert@openbsd.org>2004-07-06 03:38:14 +0000
commit9c4bd211a24240bd8fba5460b20443f6a06d1fb5 (patch)
treec5aff7e45b0eb2700d0349205a72a2067bef91d4
parentfrom netbsd, via loki@animata.net: revision 1.62. Log message: (diff)
downloadwireguard-openbsd-9c4bd211a24240bd8fba5460b20443f6a06d1fb5.tar.xz
wireguard-openbsd-9c4bd211a24240bd8fba5460b20443f6a06d1fb5.zip
Back out rev 1.2 as it doesn't make sense--since we exit on failure
there is no need to save the old value of the pointer we are realloc()ing. Based on a diff from Andrey Matveev.
-rw-r--r--usr.sbin/mailwrapper/mailwrapper.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/usr.sbin/mailwrapper/mailwrapper.c b/usr.sbin/mailwrapper/mailwrapper.c
index 7fafb23cdef..121fb0bc926 100644
--- a/usr.sbin/mailwrapper/mailwrapper.c
+++ b/usr.sbin/mailwrapper/mailwrapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mailwrapper.c,v 1.15 2003/03/09 01:24:26 millert Exp $ */
+/* $OpenBSD: mailwrapper.c,v 1.16 2004/07/06 03:38:14 millert Exp $ */
/* $NetBSD: mailwrapper.c,v 1.2 1999/02/20 22:10:07 thorpej Exp $ */
/*
@@ -67,20 +67,11 @@ initarg(struct arglist *al)
static void
addarg(struct arglist *al, const char *arg, int copy)
{
- char **argv2;
-
if (al->argc == al->maxc) {
al->maxc <<= 1;
-
- if ((argv2 = realloc(al->argv,
- al->maxc * sizeof(char *))) == NULL) {
- if (al->argv)
- free(al->argv);
- al->argv = NULL;
+ al->argv = realloc(al->argv, al->maxc * sizeof(char *));
+ if (al->argv == NULL)
err(1, "realloc");
- } else {
- al->argv = argv2;
- }
}
if (copy) {
if ((al->argv[al->argc++] = strdup(arg)) == NULL)