diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2015-04-23 17:03:02 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2015-04-23 17:03:02 +0000 |
commit | 97324562485a762ef998f7b8c9163dad12af73d1 (patch) | |
tree | 1d83c55feaebe75246f61854201559c218e215ff | |
parent | 97b9b4bccf643d1e5240c006302d5e8e8931b650 (diff) |
We cannot log errors with relay_close() before allocating
se_log evbuffer.
(Same problem as the one just fixed in httpd(8))
OK benno
-rw-r--r-- | usr.sbin/relayd/relay.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 0818a691e78..1fef01f5c0f 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.191 2015/02/06 01:37:11 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.192 2015/04/23 17:03:01 florian Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -1041,6 +1041,12 @@ relay_accept(int fd, short event, void *arg) if ((con = calloc(1, sizeof(*con))) == NULL) goto err; + /* Pre-allocate log buffer */ + con->se_haslog = 0; + con->se_log = evbuffer_new(); + if (con->se_log == NULL) + goto err; + con->se_in.s = s; con->se_in.ssl = NULL; con->se_out.s = -1; @@ -1094,14 +1100,6 @@ relay_accept(int fd, short event, void *arg) return; } - /* Pre-allocate log buffer */ - con->se_haslog = 0; - con->se_log = evbuffer_new(); - if (con->se_log == NULL) { - relay_close(con, "failed to allocate log buffer"); - return; - } - if (rlay->rl_conf.flags & F_DIVERT) { slen = sizeof(con->se_out.ss); if (getsockname(s, (struct sockaddr *)&con->se_out.ss, |