From f89c49669a4fb870d2d00eb9b449941fe9946027 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 23 Apr 2015 17:03:01 +0000 Subject: [PATCH] We cannot log errors with relay_close() before allocating se_log evbuffer. (Same problem as the one just fixed in httpd(8)) OK benno --- usr.sbin/relayd/relay.c | 16 +++++++--------- 1 file 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 @@ -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, -- 2.20.1