From: Hugo Landau Date: Thu, 27 Jul 2023 15:24:34 +0000 (+0100) Subject: QUIC UINT_SET: Fix null dereference (coverity) X-Git-Tag: openssl-3.2.0-alpha1~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8761efb2ccc96f81201af279ec66e8ceeee9c7a3;p=thirdparty%2Fopenssl.git QUIC UINT_SET: Fix null dereference (coverity) Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21565) --- diff --git a/ssl/quic/uint_set.c b/ssl/quic/uint_set.c index 3bcfdcafd05..3649e7eec24 100644 --- a/ssl/quic/uint_set.c +++ b/ssl/quic/uint_set.c @@ -111,14 +111,15 @@ static int uint_range_overlaps(const UINT_RANGE *a, static UINT_SET_ITEM *create_set_item(uint64_t start, uint64_t end) { - UINT_SET_ITEM *x = OPENSSL_malloc(sizeof(UINT_SET_ITEM)); + UINT_SET_ITEM *x = OPENSSL_malloc(sizeof(UINT_SET_ITEM)); - ossl_list_uint_set_init_elem(x); - if (x != NULL) { - x->range.start = start; - x->range.end = end; - } - return x; + if (x == NULL) + return NULL; + + ossl_list_uint_set_init_elem(x); + x->range.start = start; + x->range.end = end; + return x; } int ossl_uint_set_insert(UINT_SET *s, const UINT_RANGE *range)