EVENT QUEUE: Fix memory leak (coverity)

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21565)
This commit is contained in:
Hugo Landau 2023-07-27 15:57:51 +01:00
parent 565d2987cd
commit 77a66117ab

View File

@ -111,8 +111,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))