From 622ead6323f4492efdfab1ca9901d827536e6d4f Mon Sep 17 00:00:00 2001 From: jsg Date: Sun, 30 Apr 2023 23:49:14 +0000 Subject: [PATCH] avoid use after free ok jmatthew@ --- usr.sbin/ldapd/conn.c | 6 ++++-- 1 file 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 @@ -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); -- 2.20.1