summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-04-30 23:49:15 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-04-30 23:49:15 +0000
commit83c4094e63e2092ad7d2bdd4f5242911e78601c4 (patch)
tree8b2839381c39af508ed069555530890043274085
parente27485194b4b4ea2d5192b5a95cd866f65495c04 (diff)
avoid use after free
ok jmatthew@
-rw-r--r--usr.sbin/ldapd/conn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ldapd/conn.c b/usr.sbin/ldapd/conn.c
index 0d3759d8f2d..f63c684e6c5 100644
--- a/usr.sbin/ldapd/conn.c
+++ b/usr.sbin/ldapd/conn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conn.c,v 1.19 2023/02/03 17:43:25 tb Exp $ */
+/* $OpenBSD: conn.c,v 1.20 2023/04/30 23:49:14 jsg Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -310,8 +310,10 @@ conn_accept(int fd, short event, void *data)
bufferevent_enable(conn->bev, EV_READ);
bufferevent_settimeout(conn->bev, 0, 60);
if (l->flags & F_LDAPS)
- if (conn_tls_init(conn) == -1)
+ if (conn_tls_init(conn) == -1) {
conn_close(conn);
+ goto giveup;
+ }
TAILQ_INIT(&conn->searches);
TAILQ_INSERT_HEAD(&conn_list, conn, next);