summaryrefslogtreecommitdiffstats
path: root/ssl/d1_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-12-10 10:36:23 +0000
committerMatt Caswell <matt@openssl.org>2021-01-08 10:26:26 +0000
commitd0afb30ef3950cacff50ec539e90073b95a276df (patch)
tree55b18abd3156358a8f885a2af44f4208a5ca8d0d /ssl/d1_lib.c
parent3d0b6494d5a973d516e0944bc02b22385fca318a (diff)
Ensure DTLS free functions can handle NULL
Our free functions should be able to deal with the case where the object being freed is NULL. This turns out to not be quite the case for DTLS related objects. Fixes #13649 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13655)
Diffstat (limited to 'ssl/d1_lib.c')
-rw-r--r--ssl/d1_lib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c
index cc41eee976..62c5f26e5d 100644
--- a/ssl/d1_lib.c
+++ b/ssl/d1_lib.c
@@ -142,10 +142,11 @@ void dtls1_free(SSL *s)
ssl3_free(s);
- dtls1_clear_queues(s);
-
- pqueue_free(s->d1->buffered_messages);
- pqueue_free(s->d1->sent_messages);
+ if (s->d1 != NULL) {
+ dtls1_clear_queues(s);
+ pqueue_free(s->d1->buffered_messages);
+ pqueue_free(s->d1->sent_messages);
+ }
OPENSSL_free(s->d1);
s->d1 = NULL;