summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto@openbsd.org <otto@openbsd.org>2019-06-06 05:13:13 +0000
committerDarren Tucker <dtucker@dtucker.net>2019-06-08 00:25:42 +1000
commit0323d9b619d512f80c57575b810a05791891f657 (patch)
tree6bde14513c6fe9ff37d069325ee6baac112b6b60
parentc586d2d3129265ea64b12960c379d634bccb6535 (diff)
downloadopenssh-git-0323d9b619d512f80c57575b810a05791891f657.tar.gz
upstream: Replace calls to ssh_malloc_init() by a static init of
malloc_options. Prepares for changes in the way malloc is initialized. ok guenther@ dtucker@ OpenBSD-Commit-ID: 154f4e3e174f614b09f792d4d06575e08de58a6b
-rw-r--r--sftp-server-main.c3
-rw-r--r--sftp-server.c3
-rw-r--r--sftp.c3
-rw-r--r--ssh-add.c3
-rw-r--r--ssh-agent.c3
-rw-r--r--ssh-keygen.c3
-rw-r--r--ssh-keyscan.c3
-rw-r--r--ssh-keysign.c3
-rw-r--r--ssh-pkcs11-helper.c3
-rw-r--r--ssh.c3
-rw-r--r--sshd.c4
-rw-r--r--xmalloc.c10
12 files changed, 13 insertions, 31 deletions
diff --git a/sftp-server-main.c b/sftp-server-main.c
index 6230d897..06566d36 100644
--- a/sftp-server-main.c
+++ b/sftp-server-main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server-main.c,v 1.5 2016/02/15 09:47:49 dtucker Exp $ */
+/* $OpenBSD: sftp-server-main.c,v 1.6 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright (c) 2008 Markus Friedl. All rights reserved.
*
@@ -39,7 +39,6 @@ main(int argc, char **argv)
{
struct passwd *user_pw;
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
diff --git a/sftp-server.c b/sftp-server.c
index 19a132bd..ee6013e3 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.114 2019/01/16 23:22:10 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.115 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@@ -1574,7 +1574,6 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
extern char *optarg;
extern char *__progname;
- ssh_malloc_init(); /* must be called before any mallocs */
__progname = ssh_get_progname(argv[0]);
log_init(__progname, log_level, log_facility, log_stderr);
diff --git a/sftp.c b/sftp.c
index 44aa19d9..04881c83 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.190 2019/01/21 22:50:42 tb Exp $ */
+/* $OpenBSD: sftp.c,v 1.191 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -2388,7 +2388,6 @@ main(int argc, char **argv)
size_t num_requests = DEFAULT_NUM_REQUESTS;
long long limit_kbps = 0;
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
msetlocale();
diff --git a/ssh-add.c b/ssh-add.c
index ac9c808d..9cf29891 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-add.c,v 1.138 2019/01/21 12:53:35 djm Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.139 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -575,7 +575,6 @@ main(int argc, char **argv)
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
LogLevel log_level = SYSLOG_LEVEL_INFO;
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
diff --git a/ssh-agent.c b/ssh-agent.c
index d06ecfd9..034f3138 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.233 2019/01/22 22:58:50 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.234 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1096,7 +1096,6 @@ main(int ac, char **av)
size_t npfd = 0;
u_int maxfds;
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
diff --git a/ssh-keygen.c b/ssh-keygen.c
index db371090..01066715 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.330 2019/05/29 08:30:26 lum Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.331 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2457,7 +2457,6 @@ main(int argc, char **argv)
extern int optind;
extern char *optarg;
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 2ed04155..7b7c0f32 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.126 2019/01/26 22:35:01 djm Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.127 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
@@ -656,7 +656,6 @@ main(int argc, char **argv)
extern int optind;
extern char *optarg;
- ssh_malloc_init(); /* must be called before any mallocs */
__progname = ssh_get_progname(argv[0]);
seed_rng();
TAILQ_INIT(&tq);
diff --git a/ssh-keysign.c b/ssh-keysign.c
index 601f6ca7..9ebc6786 100644
--- a/ssh-keysign.c
+++ b/ssh-keysign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keysign.c,v 1.56 2018/11/23 05:08:07 djm Exp $ */
+/* $OpenBSD: ssh-keysign.c,v 1.57 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright (c) 2002 Markus Friedl. All rights reserved.
*
@@ -173,7 +173,6 @@ main(int argc, char **argv)
char *host, *fp;
size_t slen, dlen;
- ssh_malloc_init(); /* must be called before any mallocs */
if (pledge("stdio rpath getpw dns id", NULL) != 0)
fatal("%s: pledge: %s", __progname, strerror(errno));
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
index cb873e20..cd79db2a 100644
--- a/ssh-pkcs11-helper.c
+++ b/ssh-pkcs11-helper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11-helper.c,v 1.18 2019/05/16 08:47:27 dtucker Exp $ */
+/* $OpenBSD: ssh-pkcs11-helper.c,v 1.19 2019/06/06 05:13:13 otto Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
*
@@ -322,7 +322,6 @@ main(int argc, char **argv)
extern char *__progname;
struct pollfd pfd[2];
- ssh_malloc_init(); /* must be called before any mallocs */
__progname = ssh_get_progname(argv[0]);
seed_rng();
TAILQ_INIT(&pkcs11_keylist);
diff --git a/ssh.c b/ssh.c
index f46a3b26..d8d61411 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.501 2019/04/23 11:56:41 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.502 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -596,7 +596,6 @@ main(int ac, char **av)
struct ssh_digest_ctx *md;
u_char conn_hash[SSH_DIGEST_MAX_LENGTH];
- ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
diff --git a/sshd.c b/sshd.c
index 1fcde502..be23fbc8 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.534 2019/04/18 18:56:16 dtucker Exp $ */
+/* $OpenBSD: sshd.c,v 1.535 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1433,8 +1433,6 @@ main(int ac, char **av)
Authctxt *authctxt;
struct connection_info *connection_info = NULL;
- ssh_malloc_init(); /* must be called before any mallocs */
-
#ifdef HAVE_SECUREWARE
(void)set_auth_parameters(ac, av);
#endif
diff --git a/xmalloc.c b/xmalloc.c
index 5cc0310a..be26510c 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.34 2017/05/31 09:15:42 deraadt Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.35 2019/06/06 05:13:13 otto Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -26,15 +26,9 @@
#include "xmalloc.h"
#include "log.h"
-void
-ssh_malloc_init(void)
-{
#if defined(__OpenBSD__)
- extern char *malloc_options;
-
- malloc_options = "S";
++char *malloc_options = "S";
#endif /* __OpenBSD__ */
-}
void *
xmalloc(size_t size)