Fix typo in CONTRIBUTING.md
[openssl.git] / ssl / event_queue.c
index ed3c7909047cf2318af89440777930ef3f6c4e36..20f4020db51b4f8de05f307ab38f751c157b01d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -9,7 +9,6 @@
 
 #include <stdlib.h>
 #include "internal/event_queue.h"
-#include "crypto/sparse_array.h"
 #include "ssl_local.h"
 
 struct ossl_event_queue_st {
@@ -111,8 +110,11 @@ OSSL_EVENT *ossl_event_queue_add_new(OSSL_EVENT_QUEUE *queue,
 {
     OSSL_EVENT *e = OPENSSL_malloc(sizeof(*e));
 
-    if (e == NULL || queue == NULL)
+    if (e == NULL || queue == NULL) {
+        OPENSSL_free(e);
         return NULL;
+    }
+
     ossl_event_set(e, type, priority, when, ctx, payload, payload_size);
     e->flag_dynamic = 1;
     if (event_queue_add(queue, e))