diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-09-04 10:58:09 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-09-04 10:58:09 +0000 |
commit | 211e11ef29411b23babaf0a5d04025ce985396ec (patch) | |
tree | d91e64ae8ec20eee38f1d043192a980f31d67671 /usr.sbin/relayd | |
parent | dc21671e5784fdafb85117c08386e065e7d0ea79 (diff) |
small fix in the error path when accepting new relay sessions
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r-- | usr.sbin/relayd/relay.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 6957472a48d..efd7f20e730 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.37 2007/09/04 10:32:54 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.38 2007/09/04 10:58:08 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -1492,6 +1492,12 @@ relay_accept(int fd, short sig, void *arg) bcopy(&con->tv_start, &con->tv_last, sizeof(con->tv_last)); bcopy(&ss, &con->in.ss, sizeof(con->in.ss)); + relay_sessions++; + TAILQ_INSERT_HEAD(&rlay->sessions, con, entry); + + /* Increment the per-relay session counter */ + rlay->stats[proc_id].last++; + /* Pre-allocate output buffer */ con->out.output = evbuffer_new(); if (con->out.output == NULL) { @@ -1508,16 +1514,12 @@ relay_accept(int fd, short sig, void *arg) if (rlay->conf.flags & F_NATLOOK) { if ((cnl = (struct ctl_natlook *) - calloc(1, sizeof(struct ctl_natlook))) == NULL) - goto err; + calloc(1, sizeof(struct ctl_natlook))) == NULL) { + relay_close(con, "failed to allocate nat lookup"); + return; + } } - relay_sessions++; - TAILQ_INSERT_HEAD(&rlay->sessions, con, entry); - - /* Increment the per-relay session counter */ - rlay->stats[proc_id].last++; - if (rlay->conf.flags & F_NATLOOK && cnl != NULL) { con->cnl = cnl;; bzero(cnl, sizeof(*cnl)); |