SSL_CTX_remove_session() checks for a NULL session, avoid doing it twice.
authorjsing <jsing@openbsd.org>
Wed, 4 Aug 2021 12:41:25 +0000 (12:41 +0000)
committerjsing <jsing@openbsd.org>
Wed, 4 Aug 2021 12:41:25 +0000 (12:41 +0000)
Noted by tb@ during review of a larger change.

lib/libssl/ssl_pkt.c

index 2b1a6a4..66c57b1 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_pkt.c,v 1.47 2021/07/31 09:31:04 jsing Exp $ */
+/* $OpenBSD: ssl_pkt.c,v 1.48 2021/08/04 12:41:25 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -1204,7 +1204,7 @@ int
 ssl3_send_alert(SSL *s, int level, int desc)
 {
        /* If a fatal one, remove from cache */
-       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
+       if (level == SSL3_AL_FATAL)
                SSL_CTX_remove_session(s->ctx, s->session);
 
        S3I(s)->alert_dispatch = 1;