From: Hugo Landau Date: Thu, 27 Jul 2023 14:57:51 +0000 (+0100) Subject: EVENT QUEUE: Fix memory leak (coverity) X-Git-Tag: openssl-3.2.0-alpha1~237 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77a66117ab0c5bdd885d13dc302ace7010aca826;p=thirdparty%2Fopenssl.git EVENT QUEUE: Fix memory leak (coverity) Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21565) --- diff --git a/ssl/event_queue.c b/ssl/event_queue.c index ed3c7909047..f2169ec3abd 100644 --- a/ssl/event_queue.c +++ b/ssl/event_queue.c @@ -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))